ImageLoader

public class MyAppcilent extends Application {

@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
DisplayImageOptions defaultDisplayImageOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true).cacheOnDisk(true)
.showImageOnFail(R.drawable.ic_launcher)
.showImageOnLoading(R.drawable.ic_launcher).build();
int maxsize = (int) (Runtime.getRuntime().maxMemory() / ;
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(
getApplicationContext())
.diskCache(new UnlimitedDiskCache(getCacheDir()))
.memoryCache(new UsingFreqLimitedMemoryCache(maxsize))
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1)
.defaultDisplayImageOptions(defaultDisplayImageOptions).build();
ImageLoader.getInstance().init(configuration);
}
}

猜你喜欢

转载自shilichao.iteye.com/blog/2318754