HttpURLConnection 获取图片
来源:互联网 发布:如何提升淘宝搜索排名 编辑:程序博客网 时间:2024/06/01 08:59
private class MyRunnable implements Runnable { private final String imageUrl; private final int position; public MyRunnable(String imageUrl, int position) { this.imageUrl = imageUrl; this.position = position; } @Override public void run() { try { URL url = new URL(imageUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(4000); connection.setReadTimeout(4000); connection.connect(); if (connection.getResponseCode() == 200) { InputStream is = connection.getInputStream(); Bitmap bitmap = BitmapFactory.decodeStream(is); Message msg = Message.obtain(); msg.what = SUCCESS; msg.arg1 = position; msg.obj = bitmap; handler.sendMessage(msg); Log.e("success", "成功"); localCacheUtils.putBitmapFromUrl(imageUrl,bitmap); } } catch (Exception e) { Log.e("fail", "失败" + e.toString()); } }}
阅读全文
0 0
- HttpURLConnection获取网络图片
- HttpURLConnection获取图片数据流
- HttpURLConnection 获取图片
- 通过HttpURLConnection获取网络图片实例
- 使用HttpURLconnection从网络获取图片
- 使用HttpURLConnection从网上获取一张图片
- HttpURLConnection工具类 获取图片+Json
- android HttpURLConnection编程详解,获取网络图片,html代码查看
- android HttpURLConnection编程详解,获取网络图片,html代码查
- Android通过HttpURLConnection类进行网络通信,获取网络图片
- Android通过HttpURLConnection类进行网络通信,获取网络图片!!!
- Android通过HttpURLConnection类进行网络通信,获取网络图片
- HttpURLConnection获取网络读片,读取本地缓存图片
- Android HttpURLConnection获取网络下载图片POST请求方式
- HttpURLConnection获取网络数据(实例:网路请求图片)
- HttpURLConnection上传文件(图片)
- HttpURLConnection下载网络图片
- HttpURLConnection下载网络图片
- Travel(dij)
- JAVA概述
- 插值、逼近、拟合
- 2.单目视觉算法
- 归纳一些H5和CSS3中的常用标签及功能
- HttpURLConnection 获取图片
- plsql创建程序包和包体
- OpenWrt可以保证插件可用的AP模式设置
- 组建一台计算机3_硬件3 多位运算器
- 用迭代法求a的平方根
- Zookeeper全解析——Paxos作为灵魂
- gradle sync太慢的问题
- 关于QT5下代码中文字符编译不通过的问题
- 如何将数据上传到onenet服务器