您的位置:首页 > 其它

解决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);

大功告成
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: