简体   繁体   English

如何从Android的内存中释放下载的图像?

[英]How to free downloaded image from memory in android?

In my android app, I download images and then set them to imageviews. 在我的Android应用中,我下载了图像,然后将其设置为imageviews。 Now assuming I have the reference to the imageview, can I actually get the image from it and free it from memory manually using code? 现在假设我有对imageview的引用,实际上可以从中获取图像并使用代码手动将其从内存中释放出来吗?

Can anyone show me how to do this? 谁能告诉我该怎么做?

Thanks. 谢谢。

bitmap=null;

you can then get the bitmap back bu using BitmapFactory.decodeResource(Resources res, int id) 然后您可以使用BitmapFactory.decodeResource(Resources res, int id)获取位图

Have a look at the Abdroid developer blog for tutorials on handling loading of images. 请参阅Abdroid开发人员博客,以获取有关处理图像加载的教程。 It's a great resource 这是一个很好的资源

Loading large bitmaps 加载大位图

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

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