1

I want to create an image of a view before it's rendered as a preview.

I tried Take a screenshot of a whole View but the problem is that it gives a blank bitmap because the view was not rendered at that time.

I also tried drawing cache, but it gives me a blank bitmap as well.

Is there anyway that I can create an image of a view before it's rendered on the screen?

Thanks in advance!

Community
  • 1
  • 1

1 Answers1

0

Every View class support the creating of an image of its current display. The following coding shows an example for that.

# Build the Drawing Cache
view.buildDrawingCache();

# Create Bitmap
Bitmap cache = view.getDrawingCache();

# Save Bitmap
saveBitmap(cache);
view.destroyDrawingCache(); 

And it is not possible to take a screenshot of a view before it's rendered.

Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300