ImageLoder
来源:互联网 发布:知彼手机定位苹果 编辑:程序博客网 时间:2024/06/07 08:27
//初使化
ImageLoaderConfiguration configuration=new ImageLoaderConfiguration.Builder(this)
.threadPoolSize(3)//设置线程池
.memoryCacheExtraOptions(480,800)//内存缓存区图片的大小
.memoryCacheSize(5*1024*1024)//设置内存缓存区的大小
.memoryCache(new LruMemoryCache(5*1024*1024))//设置内存缓存
.diskCache(new UnlimitedDiscCache(getExternalCacheDir()))//自定义缓存目录,设置磁盘缓存
.diskCacheFileCount(100)//磁盘缓存文件的数量
.diskCacheSize(20*1024*1024)//磁盘缓存区空间大小
.diskCacheFileNameGenerator(new Md5FileNameGenerator())//设置缓存文件的文件名为md5加密方式
.writeDebugLogs()//写入日志
.build();
ImageLoader.getInstance().init(configuration);
}
}
//适配器
options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_error)
.showImageOnLoading(R.drawable.ic_stub)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
//进行网络判断
boolean bisConnFlag=false;
ConnectivityManager conManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo network = conManager.getActiveNetworkInfo();
if(network!=null){
bisConnFlag=conManager.getActiveNetworkInfo().isAvailable();
}
return bisConnFlag;
}
/**
* 当判断当前手机没有网络时选择是否打开网络设置
* @param context
*/
public static void showNoNetWorkDlg(final Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setIcon(R.mipmap.ic_launcher) //
.setTitle(R.string.app_name) //
.setMessage("当前无网络").setPositiveButton("设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 跳转到系统的网络设置界面
Intent intent = null;
// 先判断当前系统版本
if(android.os.Build.VERSION.SDK_INT > 10){ // 3.0以上
intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
}else{
intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.WirelessSettings");
}
context.startActivity(intent);
}
}).setNegativeButton("知道了", null).show();
//依赖
compile 'com.github.userswlwork:pull-to-refresh:1.0.0' // pulltoresh依赖包 上拉刷新
compile 'com.youth.banner:banner:1.4.9'//无线轮播依赖
- imageloder
- imageLoder
- ImageLoder
- imageloder
- imageloder
- imageLoder
- ImageLoder
- imageloder
- Imageloder
- ImageLoder
- imageloder常见问题
- ImageLoder配置
- ImageLoder画圆
- ImageLoder工具包
- Listview+ImageLoder
- ImageLoder使用
- ImageLoder的简单使用
- Imageloder 源码阅读笔记
- 思考力|《零秒思考》
- Bootstrap Search Suggest与php边输入边查询
- 机器学习算法与Python实践(4)
- 迭代法与开方求值
- Python使用Windows API创建窗口
- ImageLoder
- Python创建对话框
- python处理按钮消息
- 贝塞尔曲线扫盲
- 未处理NullReferenceException--未将对象引用设置到对象的实例
- JAVAWEB第二天 JS函数与变量
- python向对话框中添加控件
- csdn博客开通啦
- java通过Annotation对象获取注解属性的值