解决ImageLoader must be init with configuration before using
2015-10-06 09:13
477 查看
用 ImageLoader这个库来加载图片无疑是个好选择,但是有时候会出现ImageLoader must be init with configuration before using 这是说ImageLoader 没有初始化,你可以选择在activity里面初始化 但是最好在Application 里面使用 一劳永逸。 方法如下
public static void initImageLoader(Context context) {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context).threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.tasksProcessingOrder(QueueProcessingType.LIFO)
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
然后再oncreak里面加上
Context context = getApplicationContext();
initImageLoader(context);
大功告成
public static void initImageLoader(Context context) {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context).threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.tasksProcessingOrder(QueueProcessingType.LIFO)
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
然后再oncreak里面加上
Context context = getApplicationContext();
initImageLoader(context);
大功告成
相关文章推荐
- iOS 高德地图
- SpriteBuilder中使用TrueType字体的一些障碍
- SpriteBuilder中使用TrueType字体的一些障碍
- 线段树 csu1555 Inversion Sequence
- 《Python基础教程 第2版·修订版》第3章 使用字符串(学习笔记)
- iOS 百度地图
- 建枚举类时出现“Project '**' is not a J2SE 5.0 compliant project.”问题怎么办?
- 新建SVN仓库设置
- iOS block传值
- iOS coredata的使用及版本升级
- iOS M3U8视频的下载与播放
- com.mysql.jdbc.MysqlDataTruncation: Data truncation异常
- iOS masonry进行页面适配
- iOS AFN进行断点下载
- iOS FMDB自己封装的单例类
- Log4j官方文档翻译(九、输出到数据库)
- struts拦截器和action
- 集电极开路、漏极开路、上拉电阻、下拉电阻等接口相关基本概念
- swift2.0 计算圆面积
- 使用wordpress的$wpdb类读mysql数据库做ajax时出现的问题及解决