Sadeel Anjum
Sadeel Anjum

Reputation: 135

Getting current image from imageview (android)

I have an ImageView in which I load images from camera and gallery , and I do it using imgview.setimagebitmap(bitmap) ,( and I change the image again and again ) it works fine, but when I try to get the current image back for some processing (applying effect or rotate) it returns me the old image not the current one.

I think the problem is with imgview.setimagebitmap(bitmap). can I be helped?

I have the following code:

try {
    iv_image.buildDrawingCache();
    Bitmap source = iv_image.getDrawingCache();
} catch(Exception ex) {
    int a;
    int b;
    a = 11;
    b = 12;
}

Upvotes: 0

Views: 2012

Answers (1)

J.Vassallo
J.Vassallo

Reputation: 2292

Can you please try to obtain the batman as follows :

Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap()

Upvotes: 1

Related Questions