Challenge: Icons, Reordering Tasks

You used ResolveInfo.loadLabel(…) in this chapter to present useful names in your launcher. ResolveInfo provides a similar method called loadIcon() that retrieves an icon to display for each application. For a small challenge, add an icon for each application to NerdLauncher.

If you are interested in doing more, you can add another activity to NerdLauncher that switches between running tasks. To do this, use the ActivityManager system service, which provides information about currently running activities, tasks, and applications. Unlike PackageManager, Activity provides no getActivityManager() convenience method for getting at this system service.

Instead, call Activity.getSystemService() with the Activity.ACTIVITY_SERVICE ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.