May 26, 2011

Capture Screen, using View.getDrawingCache()

To capture screen, such as in a view, we can use the following code:
 View screen = (View)findViewById(R.id.screen);

screen.setDrawingCacheEnabled(true);
Bitmap bmScreen = screen.getDrawingCache();



where screen is the view, to be captured.



it's a working example here: Create custom dialog with dynamic content, updated in onPrepareDialog().

1 comment:

  1. I want to capture frame of surface view, but it's giving me transparent image, any idea/suggestion please?

    ReplyDelete

Infolinks In Text Ads