Android的图像缓存 [英] Android image caching
本文介绍了Android的图像缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何缓存图片后,他们是从网上下载的?
How can I cache images after they are downloaded from web?
推荐答案
而现在的警句:使用系统缓存
And now the punchline: use the system cache.
URL url = new URL(strUrl);
URLConnection connection = url.openConnection();
connection.setUseCaches(true);
Object response = connection.getContent();
if (response instanceof Bitmap) {
Bitmap bitmap = (Bitmap)response;
}
同时提供内存和闪存-ROM缓存,与浏览器共享。
Provides both memory and flash-rom cache, shared with the browser.
GRR。我希望有人告诉我,以前我写我自己的高速缓存管理器。
grr. I wish somebody had told ME that before i wrote my own cache manager.
这篇关于Android的图像缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文