如何缓存图片后,他们是从网上下载的?
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.