Skip to content Skip to sidebar Skip to footer

How To Screenshot Or Snapshot A View Before It's Rendered?

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

Solution 1:

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.

Post a Comment for "How To Screenshot Or Snapshot A View Before It's Rendered?"