MyApp磁盘缓存

public class MyApp extends Application {
    private Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        context = this;
        File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/bawei");
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .diskCache(new UnlimitedDiskCache(file)) // default
                .build();
        ImageLoader.getInstance().init(config);
    }

    public static DisplayImageOptions getOptions() {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(true) // default
                .cacheOnDisk(true) // default
                .build();
        return options;
    }
}

猜你喜欢

转载自blog.csdn.net/aa15362415/article/details/80514955