我试图从SimpleDraweeView获取位图。从壁画获取位图
我已经设置好的我SimpleDraweeView与URI图像:
final Uri uri = new Uri.Builder()
.scheme(UriUtil.LOCAL_RESOURCE_SCHEME)
.path(returnUri.getPath())
.build();
profileImage.setImageURI(returnUri);
而现在我想将图像保存在手机的内存(存储)。
Bitmap b = ((BitmapDrawable) profileImage.getDrawable()).getBitmap(); // ImageDiskHelper.drawableToBitmap(profileImage.getDrawable().get);
try {
ImageDiskHelper.saveToInternalStorage(b, "MyActualProfileImage");
} catch(Exception c){ }
但是,如果使用上面的代码我得到:com.facebook.drawee.generic.RootDrawable不能转换到android.graphics.drawable.BitmapDrawable
我转换profileImage.getDrawable为位图图像是这样的:empty image
我试图让正在由该SimpleDraweeView
你为什么要这样做? Fresco已经为您管理所有的缓存等。 –
@AlexanderOprisnik我能想到的一个很好的理由就是用于UI测试,它可以访问可绘制的位图,但要做到这一点,我们需要从一个普通的drawable开始,并且我不知道如何投射那个 –
因为我想让用户看到一些图像,然后将其保存到存储中 –