I'm trying to the the application and icons for Recent Tasks, but I
can't seem to get the appInfo using the RecentTaskInfo. The
getApplicationInfo call is what is failing due to the getPackageName()
returning null.
ActivityManager manager =
(ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<RecentTaskInfo> tasks = manager.getRecentTasks(50, 1);
for (int counter = 0; counter < tasks.size(); counter++)
{
RecentTaskInfo task = tasks.get(counter);
PackageManager pm = this.getPackageManager();
try {
ApplicationInfo appInfo =
pm.getApplicationInfo(task.origActivity.getPackageName(),0);
String applicationName =
getPackageManager().getApplicationLabel(appInfo).toString();
Drawable icon = appInfo.loadIcon(pm);
.....
I've also tried:
ApplicationInfo appInfo =
pm.getApplicationInfo(task.baseIntent.getPackage(),0);
In which getPackage() is returning null.. maybe I'm going about this
the wrong way and was hoping for some tips?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.