Get Bitmap attached to ImageView

lemon picture lemon · Nov 29, 2011 · Viewed 223.6k times · Source

Given

ImageView image = R.findViewById(R.id.imageView);
image.setImageBitmap(someBitmap);

Is it possible to retrieve the bitmap?

Answer

Arslan Anwar picture Arslan Anwar · Nov 29, 2011
Bitmap bitmap = ((BitmapDrawable)image.getDrawable()).getBitmap();