I used to snap bitmaps of activities by taking their content view and drawing it:
View view = activity.findViewById(android.R.id.content)
Bitmap bitmap = Bitmap.createBitmap(
view.getWidth(), view.getHeight(), Config.ARGB_8888
);
view.draw(new Canvas(bitmap));
Now I’m using an ActionBar, and it’s not nested under the content view, so it’s left out. How can I obtain the real root view? Or snap a picture with the action bar in some other way, if that’s not possible?
To get a Bitmap for the entire window including ActionBar you can use the DecorView.
First you need to enable drawing cache
get the bitmap
Use the bitmap elsewhere, I try this with a ImageView and works great.
disable drawing cache