Capturing Bitmaps of Views in Android

www.‮‬lautturi.com
Capturing Bitmaps of Views in Android

A View can actually draw itself on any instance of a Canvas class.

Bitmap b = Bitmap.createBitmap(targetView.getWidth(),
                   targetView.getHeight(),
                   Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
targetView.draw(c);
BitmapDrawable d = new BitmapDrawable(getResources(), b);
canvasView.setBackgroundDrawable(d);
Created Time:2017-08-30 15:01:37  Author:lautturi