ImagerLoder相关配置
public class MyApp extends Application {
static Context context;
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
context = getApplicationContext();
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true).cacheOnDisk(true)
.showImageForEmptyUri(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.showImageOnLoading(R.mipmap.ic_launcher).build();
int sizeMax = (int) (Runtime.getRuntime().maxMemory() / 8);
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(
getApplicationContext()).defaultDisplayImageOptions(options)
.diskCache(new UnlimitedDiskCache(getCacheDir()))
.memoryCache(new UsingFreqLimitedMemoryCache(sizeMax)).build();
ImageLoader.getInstance().init(configuration);
}
public static Context getAppliContext() {
return context;
}
}