android ImageLoader加载本地图片的工具类
import android.widget.ImageView; import com.nostra13.universalimageloader.core.ImageLoader; /**
* 异步加载本地图片工具类
*
* @author tony
*
*/
public class LoadLocalImageUtil {
private LoadLocalImageUtil() {
} private static LoadLocalImageUtil instance = null; public static synchronized LoadLocalImageUtil getInstance() {
if (instance == null) {
instance = new LoadLocalImageUtil();
}
return instance;
} /**
* 从内存卡中异步加载本地图片
*
* @param uri
* @param imageView
*/
public void displayFromSDCard(String uri, ImageView imageView) {
// String imageUri = "file:///mnt/sdcard/image.png"; // from SD card
ImageLoader.getInstance().displayImage("file://" + uri, imageView);
} /**
* 从assets文件夹中异步加载图片
*
* @param imageName
* 图片名称,带后缀的,例如:1.png
* @param imageView
*/
public void dispalyFromAssets(String imageName, ImageView imageView) {
// String imageUri = "assets://image.png"; // from assets
ImageLoader.getInstance().displayImage("assets://" + imageName,
imageView);
} /**
* 从drawable中异步加载本地图片
*
* @param imageId
* @param imageView
*/
public void displayFromDrawable(int imageId, ImageView imageView) {
// String imageUri = "drawable://" + R.drawable.image; // from drawables
// (only images, non-9patch)
ImageLoader.getInstance().displayImage("drawable://" + imageId,
imageView);
} /**
* 从内容提提供者中抓取图片
*/
public void displayFromContent(String uri, ImageView imageView) {
// String imageUri = "content://media/external/audio/albumart/13"; //
// from content provider
ImageLoader.getInstance().displayImage("content://" + uri, imageView);
} }
android ImageLoader加载本地图片的工具类的更多相关文章
- UIWebView如何加载本地图片
		
UIWebView如何加载本地图片 UIWebView加载本地图片是有实用价值的.比方说,有时候我们需要本地加载静态页来显示相关帮助信息,而这些帮助信息当中含有很多很多的富文本,用代码实现难度较大,这 ...
 - angular 图片加载失败 情况处理? 如何在ionic中加载本地图片 ?
		
1.angular 图片加载失败 情况处理 在directive中定义组件,在ng-src错误时,调用err-src app.directive('errSrc',function(){ return ...
 - Android View加载圆形图片且同时绘制圆形图片的外部边缘边线及边框:LayerDrawable实现
		
 Android View加载圆形图片且同时绘制圆形图片的外部边缘边线及边框:LayerDrawable实现 LayerDrawable实现的结果和附录文章1,2,3中的layer-list一致. ...
 - Android ImageView加载圆形图片且同时绘制圆形图片的外部边缘边线及边框
		
 Android ImageView加载圆形图片且同时绘制圆形图片的外部边缘边线及边框 在Android早期的开发中,如果涉及到圆形图片的处理,往往需要借助于第三方的实现,见附录文章1,2.And ...
 - Flutter学习笔记(19)--加载本地图片
		
如需转载,请注明出处:Flutter学习笔记(19)--加载本地图片 上一篇博客正好用到了本地的图片,记录一下用法: 首先新建一个文件夹,这个文件夹要跟目录下 然后在pubspec.yaml里面声明出 ...
 - !!!myeclipse 上加载本地图片问题,无法加载问题
		
出现无法加载本地图片的问题, 原因就是把图片放到了本地项目中的image了,但是myeclipse上没有刷新 这样以后 本地的图片比在线的要快 低级错误,诶!
 - 用UIWebView加载本地图片和gif图
		
加载gif图: NSData *gif = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@" ...
 - Android 中加载本地Html 跨域问题,http协议允许加载
		
一.需求: 后台加载HTML的包时间太长,太卡,让把所有的HTML包放到前台:使用的是file://协议,有些内容和样式加载不出来,H5那边说需要用http://协议来加载: 二.处理过程: 安卓最简 ...
 - fresco加载本地图片、gif资源
		
首先 来看看fresco 是个神马东西 https://github.com/facebook/fresco 这个是fresco的一个官方gifhub 官网为http://frescolib.org/ ...
 
随机推荐
- C++桥接模式【转】
			
https://www.cnblogs.com/jiese/p/3164940.html 将抽象部份与它的实现部份分离,使它们都可以独立地变化. 桥接模式号称设计模式中最难理解的模式之一,关键就是这个 ...
 - 【pygame游戏编程】第一篇-----创建一个窗口
			
下面我们一起来创建一个背景为蓝色的窗口作为游戏编程的开始: import sys import pygame def creat_screen(): #初始化pygame pygame.init() ...
 - python中集合-set
			
集合-set 集合是高中数学中的一个概念 一堆确定的无序的唯一的数据,集合中每一个数据成为一个元素 # 集合的定义 s = set() print(type(s)) print(s) print(&q ...
 - 转发:tomcat的acess_log打印post请求参数,分析日志
			
转载自:https://blog.csdn.net/qq_30121245/article/details/52861935 1) 在项目中加入相应的包和类,加载那里无所谓,只要web.xml配置正确 ...
 - (网页)javascript小技巧(非常全)
			
事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcE ...
 - 导入另一个 Git库到现有的Git库并保留提交记录
			
在要合并到的目标git仓库,执行 "git pull 远程分支地址/本地git仓库根目录"
 - [20170728]oracle保留字.txt
			
[20170728]oracle保留字.txt --//oracle有许多保留字,我印象最深的就是使用rman备份表空间test,test就是rman里面的保留字.--//还有rman也是rman里面 ...
 - @addTagHelper的使用
			
@addTagHelper用来在cshtml页面加入自定义的Tag @addTagHelper “[the full type name of taghelper,] the assembly nam ...
 - EasyUI报错 $(...).accordion is not a function
			
参考资料: https://stackoverflow.com/questions/9017634/accordion-is-not-a-function 原因:加载了2次jquery js文件
 - Centos7.5.1804永久生效修改主机名
			
原来主机名 [root@node1 ~]# 查看Centos的版本: [root@node1 ~]# cat /etc/redhat-release CentOS Linux release (Cor ...