Android的图像缓存缓存、图像、Android

2023-09-11 11:36:16 作者:你能填满我小小的世界

如何缓存图片后,他们是从网上下载的?

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.

 
精彩推荐
图片推荐