Showing list of running tasks


The book says to use getRunningTasks() to return a List of ActivityManager.RunningTaskInfo to get the list of running tasks. But when displaying the list in getView I can’t figure out how to get the title of app or image of the app from an ActivityManager.RunningTaskInfo item


I am referring to the second part of the challenge that asks the reader to add code to be able to swap between running tasks


I figured it out. You can use RunningTaskInfo.baseActivity.getPackageName() to get the package name of the RunningTaskInfo item, then you can use the method talked about here:

to get the app name from the package name.