As far as I see on Android 4.0 (or higher) default task manager shows last screenshot from program with program icon no the top left. See image:
My question is how to change application's image (not icon) in task manager to custom? Don't ask me why, I just need it.
After some research I found similar question on SO: Show black preview screen in task manager on ICS. But it doesn't answers my question.
Also I didn't find any API to work with this task manager.
So I decided to show custom image when program (activity) turns off. From activity lifecycle I found that I need to override method onPause
. So I decided to code a small program. It's very easy to understand:
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume()
{
super.onResume();
setContentView(createImageView("/sdcard/program-image.jpg"));
}
@Override
public void onPause()
{
setContentView(createImageView("/sdcard/task-manager-image.jpg"));
super.onPause();
}
private ImageView createImageView(String pathFile)
{
ImageView imageView = new ImageView(getApplication());
imageView.setImageBitmap(BitmapFactory.decodeFile(pathFile));
imageView.invalidate();
return imageView;
}
}
The task-manager-image
really shows for a while after pressing Home button, but task manager shows only program-image
.
So is there any good solution to do this?
Thanks for any help.