public class ImageLoaderUtils extends Application {
@Override
public void onCreate() {
super.onCreate();
//定义一个文件放图片路径
File file = new File(Environment.getExternalStorageDirectory(), "/ima");
//判断文件是否存在
if (file.exists()){
file.mkdir();
}
ImageLoaderConfiguration build = new ImageLoaderConfiguration.Builder(this)
.diskCache(new UnlimitedDiskCache(file))
//图片大小
.diskCacheSize(50*1024*1024)
//图片个数
.diskCacheFileCount(50)
.build();
ImageLoader.getInstance().init(build);
}
}