I want to get Bitmap
from ImageView
. I have used following code, but getDrawable()
returns null. How to get whole Bitmap
from ImageView
.
Bitmap bitmap;
if (mImageViewer.getDrawable() instanceof BitmapDrawable) {
bitmap = ((BitmapDrawable) mImageViewer.getDrawable()).getBitmap();
} else {
Drawable d = mImageViewer.getDrawable();
bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
d.draw(canvas);
}
storeImage(bitmap,"final.jpeg");
question from:
https://stackoverflow.com/questions/26865787/get-bitmap-from-imageview-in-android-l 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…