常用代码片段(一) - 加载网络图片
2011-03-08 09:01
232 查看
一、关键字
Image. URL, URLConnection, BitmapFactory二、代码片段
public Bitmap getRemoteImage(final URL aURL) { try { final URLConnection conn = aURL.openConnection(); conn.connect(); final BufferedInputStream bis = new BufferedInputStream(conn.getInputStream()); final Bitmap bm = BitmapFactory.decodeStream(bis); bis.close(); return bm; } catch (IOException e) { Log.d("DEBUGTAG", "Oh noooz an error..."); } return null; }
相关文章推荐
- 【代码笔记】iOS-实现网络图片的异步加载和缓存
- 一个超级好用的加载网络图片的轮播图(3行代码就可搞定)
- 加载网络图片的常用框架
- Android Volley入门到精通:使用Volley加载网络图片(示例,出错代码)
- [网络收集]网页常用js代码片段收集
- Android 自定义圆形头像CircleImageView支持加载网络图片的实现代码
- 网络图片延迟加载实现代码 超越jquery控件
- Android利用AsyncTask异步加载网络图片,详细教程,图+代码+文字+项目
- 原生代码加载网络图片和Volley和Picasso的简单介绍和优缺点对比
- 网络图片延迟加载实现代码 超越jquery控件
- H5常用JS代码片段, 判断设备&JS预加载
- 网络下载图片并显示代码片段
- ImageView简单加载网络图片实例代码
- ListView异步加载图片是非常实用的方法,凡是是要通过网络获取图片资源一般使用这种方法比较好,用户体验好,下面就说实现方法,先贴上主方法的代码:
- 一句代码加载网络图片到ImageView——Android Picasso
- 【代码笔记】iOS-实现网络图片的异步加载和缓存
- Android Volley入门到精通:使用Volley加载网络图片(示例,出错代码)
- Android网络加载图片只需一行代码!!!!
- 近期的安卓学习开发SOS APP的一些总结文档 (拨打电话 加载首页图片的异步代码 判断是否有网络代码)
- 近期的安卓学习开发SOS APP的一些总结文档 (拨打电话 加载首页图片的异步代码 判断是否有网络代码)