简体   繁体   English

将图像从imageview保存到Drawable,反之亦然

[英]Saving image from imageview to Drawable and vice versa

I want to save my current ImageView image to Drawable and later on retrieve that image from the Drawable and render it to ImageView . 我想将当前的ImageView图像保存到Drawable然后再从Drawable检索该图像并将其渲染到ImageView Has anyone faced a similar problem? 有没有人遇到过类似的问题?

This is my code so far to retrieve the image from Drawable but it's not working... 到目前为止,这是我的代码,可从Drawable检索图像,但无法正常工作...

Drawable d = this.getResources().getDrawable(R.drawable.icon);
mImageView.setImageURI(Uri.parse(d));

You are trying to set image by URI. 您正在尝试通过URI设置图像。 Use this instead: 使用此代替:

mImageView.setImageDrawable(d);

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

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