Reputation: 11
I want to take a screen shot of a layout that is nested (in between) main layout. I'm using following code:
public static Bitmap captureScreen(View v) {
Bitmap bitmap = null;
try {
if (v != null) {
int width = v.getWidth();
int height = v.getHeight();
screenshot = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
v.draw(new Canvas(screenshot));
}
} catch (Exception e) {
Log.d("captureScreen", "Failed");
}
return bitmap;
}
on button click it would be like :
captureScreen(midlayout);
Upvotes: 1
Views: 69