0

I try to take a screenshot of the an entire RelativeLayout group of views and show it in an AlertDialog but the picture is black.

This is what the actual RelativeLayout looks like:

The actual Relative Layout

This is what I am getting in the dialog:

The picture is black

This is my code:

enter image description here

I learned it here.

Daniel
  • 2,355
  • 9
  • 23
  • 30
joe doe
  • 117
  • 9

1 Answers1

0

From the code you've posted, it looks like you're just creating the Bitmap and not actually drawing anything into it. You can generate a bitmap of your view group by force-building the drawing cache of your view and pulling the image from the cache. Then, you should be able to add the Bitmap to your ImageView. See the example below:

viewGroup.buildDrawingCache();
Bitmap viewGroupBitmap = viewGroup.getDrawingCache();

image.setImageBitmap(viewGroupBitmap);

Hope this helps.

Spencer
  • 306
  • 1
  • 14