I'd like to get some thumbnail images of the running applications. The
combination of RunningTaskInfo.thumbnail and
Activity.onCreateThumbnail seems like just the thing but I don't see
it working. I've overridden onCreateThumbnail in my main Activity.
According to the documentation, this method is called by the framework
when the activity is paused. I've set a breakpoint in the method and
it never seems to be hit. The base implementation of onCreateThumbnail
would work just fine if it would fire.

@Override
public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas)
{
        return super.onCreateThumbnail(outBitmap, canvas);
}

Also, I've written some simple code to getRunningTasks from the
ActivityManager. The RunningTaskInfo.thumbnail property is always
null. Is there something I need to set within an application so that
it will generate it's thumbnail before onPause? Is something needed in
the manifest. The documentation on this feature is sparse.

Here's some [simplified] code I use in an extension of BaseAdapter  to
fetch the running tasks:

ActivityManager manager = (ActivityManager)context.getSystemService
(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> tasks = manager.getRunningTasks(10);
RunningTaskInfo info = tasks.get(arg0);
LayoutInflater inflater = (LayoutInflater)context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.taskitem, null);
ImageView image = (ImageView)view.findViewById(R.id.image);
TextView label = (TextView)view.findViewById(R.id.label);
label.setText(info.baseActivity.getPackageName());
Bitmap bmp = info.thumbnail;
image.setImageBitmap(bmp);



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to