Skip to content Skip to sidebar Skip to footer

Copy Bitmap Contents Of One ImageView To Anoher

This has me baffled. I need to copy the Bitmap from one ImageView into another. I do not want to simply copy one ImageView to another because I need to do some changes to the bit

Solution 1:

Not used the drawing cache, but wouldn't you need to call buildDrawingCache() ?

The way I'd do it:

Bitmap bmSrc1 = ((BitmapDrawable)ivSrc.getDrawable()).getBitmap();
Bitmap bmSrc2 = bmSrc1.copy(bmSrc1.getConfig(), true);

Note that bmSrc2 is mutable, i.e. you can stick it in a Canvas and do whatever you like with it before drawing it somewhere.


Post a Comment for "Copy Bitmap Contents Of One ImageView To Anoher"