缓存设置
public class Imageloader extends Application {
private File file;
@Override
public void onCreate() {
super.onCreate();
String mPath=getExternalCacheDir().getPath()+"/image";
file = new File(mPath);
ImageLoaderConfiguration build = new ImageLoaderConfiguration.Builder(this)
.memoryCache(new LRULimitedMemoryCache(2*1024*1024))
.memoryCacheSize(2*1024*1024)
.diskCacheSize(50*1024*1024)
.diskCacheSize(100)
.diskCache(new UnlimitedDiskCache(file))
.defaultDisplayImageOptions(Options())
.build();
com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(build);
}
private DisplayImageOptions Options() {
return new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.ti)
.cacheOnDisk(true)
.cacheInMemory(true)
.build();
}
}