首页 > 移动平台 > 详细

Android ImageLoader使用

时间:2014-02-27 21:11:08      阅读:745      评论:0      收藏:0      [点我收藏+]

首先需要,设置网络权限

其次继承于Application的子类,作为加载的其实类,初始化ImageLoader的配置参数

public class MyApplication extends Application {
   @Override
   public void onCreate() {
       // TODO Auto-generated method stub
       super.onCreate();
       ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
               getApplicationContext())
               .threadPriority(Thread.NORM_PRIORITY - 2)
               .denyCacheImageMultipleSizesInMemory()
               .discCacheFileNameGenerator(new Md5FileNameGenerator())
               .tasksProcessingOrder(QueueProcessingType.LIFO)
               .writeDebugLogs() // Remove for release app
               .build();
       ImageLoader.getInstance().init(config);
   }
}

从中可以看出ImageLoader是一个单例,因此使用是可以直接使用(参数初始化已经配置);

简单实用

           ImageLoader.getInstance().displayImage(uri, imageAware)
既可以异步加载图片

具体可参考github:https://github.com/nostra13/Android-Universal-Image-Loader

Android ImageLoader使用,布布扣,bubuko.com

Android ImageLoader使用

原文:http://leerain.blog.51cto.com/8277864/1363973

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!