Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 缓存磁盘映像_Android_Caching - Fatal编程技术网

Android 缓存磁盘映像

Android 缓存磁盘映像,android,caching,Android,Caching,我试图使用磁盘缓存(而不是内存缓存),所以我从URL下载图像并将其放在网格视图中。我只想下载一次我的图片 我在谷歌网站上找到了这个例子(bitmapFun): 我觉得这个例子有点复杂。 util包中有许多对象(AsyncTask、DiskLruCache、ImageCache、ImageFetcher、ImageResizer、ImageWorker、Utils) 是否有一种方法或教程可以说明如何在不使用所有这些对象的情况下使用磁盘Lru缓存。 我不想调整图像大小,无法删除ImageResize

我试图使用磁盘缓存(而不是内存缓存),所以我从URL下载图像并将其放在网格视图中。我只想下载一次我的图片

我在谷歌网站上找到了这个例子(bitmapFun):

我觉得这个例子有点复杂。 util包中有许多对象(AsyncTask、DiskLruCache、ImageCache、ImageFetcher、ImageResizer、ImageWorker、Utils)

是否有一种方法或教程可以说明如何在不使用所有这些对象的情况下使用磁盘Lru缓存。
我不想调整图像大小,无法删除ImageResizer类。

这里有一个很好的答案:。报价:

“考虑使用Sergey Tarasevich的产品。它附带:

//Multithread image loading. It lets you can define the thread pool size
//Image caching in memory, on device's file sytem and SD card.
//Possibility to listen to loading progress and loading events
Universal Image Loader允许使用以下缓存配置对下载的图像进行详细的缓存管理:

UsingFreqLimitedMemoryCache: //The least frequently used bitmap is deleted when the cache size limit is exceeded.
LRULimitedMemoryCache: //The least recently used bitmap is deleted when the cache size limit is exceeded.
FIFOLimitedMemoryCache: //The FIFO rule is used for deletion when the cache size limit is exceeded.
LargestLimitedMemoryCache: //The largest bitmap is deleted when the cache size limit is exceeded.
LimitedAgeMemoryCache: //The Cached object is deleted when its age exceeds defined value.
WeakMemoryCache: //A memory cache with only weak references to bitmaps.
一个简单的用法示例:

ImageView imageView = groupView.findViewById(R.id.imageView);
String imageUrl = "http://domain.com/image.png"; 

ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(context));
imageLoader.displayImage(imageUrl, imageView);
此示例使用默认的
使用FreqLimitedMemoryCache

可能的重复: