[英]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.