[android-developers] Re: RunningTaskInfo.thumbnail is always null and onCreateThumbnail never called
This is not currently supported. We weren't using it anywhere in the UI on the G1, so we turned it off to avoid wasting time/space. On Wed, Jan 21, 2009 at 6:46 AM, drasticp wrote: > > 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 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); > > > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: RunningTaskInfo.thumbnail is always null and onCreateThumbnail never called
Hey Dianne, Thanks for your reply! I need this functionality and I've built something similar into the internals. However, something tells me that you guys did a much better job. :) I can see that most of your work is still there, but I can't seem to follow it completely. Can you tell me where to turn it back on and/or move this thread to the internals discussion? On Jan 21, 1:46 pm, Dianne Hackborn wrote: > This is not currently supported. We weren't using it anywhere in the UI on > the G1, so we turned it off to avoid wasting time/space. > > > > On Wed, Jan 21, 2009 at 6:46 AM, drasticp wrote: > > > 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 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); > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support. All such questions should be posted on public > forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: RunningTaskInfo.thumbnail is always null and onCreateThumbnail never called
There is just an if statement in android.app.ActivityThread.java that has it currently turned off. On Fri, Jan 23, 2009 at 8:34 PM, drasticp wrote: > > Hey Dianne, Thanks for your reply! I need this functionality and I've > built something similar into the internals. However, something tells > me that you guys did a much better job. :) I can see that most of > your work is still there, but I can't seem to follow it completely. > Can you tell me where to turn it back on and/or move this thread to > the internals discussion? > > On Jan 21, 1:46 pm, Dianne Hackborn wrote: > > This is not currently supported. We weren't using it anywhere in the UI > on > > the G1, so we turned it off to avoid wasting time/space. > > > > > > > > On Wed, Jan 21, 2009 at 6:46 AM, drasticp wrote: > > > > > 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 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); > > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > > Note: please don't send private questions to me, as I don't have time to > > provide private support. All such questions should be posted on public > > forums, where I and others can see and answer them. > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---