简体   繁体   English

从imageview获取当前图像(android)

[英]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. 我有一个ImageView ,它从相机和图库中加载图像,并使用imgview.setimagebitmap(bitmap) ,(并且我一次又一次地更改图像)来完成它,但是可以正常工作,但是当我尝试获取当前图像时对于某些处理(应用效果或旋转),它会返回旧图像而不是当前图像。

I think the problem is with imgview.setimagebitmap(bitmap) . 我认为问题出在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;
}

您能否按以下方式尝试获得蝙蝠侠:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM