AppLication
package com.example.dell.week1217;
import android.app.Application;
import android.graphics.Bitmap;
import android.os.Environment;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import java.io.File;
public class App extends Application {
File file = new File(Environment.getExternalStorageDirectory()+"/"+"Image");
@Override
public void onCreate() {
super.onCreate();
ImageLoaderConfiguration loaderConfiguration = new ImageLoaderConfiguration.Builder(this)
.diskCache(new UnlimitedDiskCache(file))
.memoryCacheSize(10)
.diskCacheSize(10 * 1024 * 1024)
.defaultDisplayImageOptions(new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.RGB_565)
.showImageOnLoading(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.showImageForEmptyUri(R.mipmap.ic_launcher)
.cacheOnDisk(true)
.cacheInMemory(true)
.displayer(new RoundedBitmapDisplayer(100))
.build()
).build();
ImageLoader.getInstance().init(loaderConfiguration);
}
}