Skip to content

Instantly share code, notes, and snippets.

@johnnyeric
Created June 15, 2015 02:52
Show Gist options
  • Select an option

  • Save johnnyeric/6c9b1263e75f4b6e6634 to your computer and use it in GitHub Desktop.

Select an option

Save johnnyeric/6c9b1263e75f4b6e6634 to your computer and use it in GitHub Desktop.
Android - This method extracts the bitmap from an Android view
public static Bitmap loadBitmapFromView(View view) {
Bitmap bitmap = Bitmap.createBitmap( view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.draw(canvas);
return bitmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment