A优化添加图片
来源:互联网 发布:淘宝店招模板制作 编辑:程序博客网 时间:2024/04/27 18:24
private void dispalyImage(final String picUrl, final ImageView imageView) { AsyncTask<Void, Void, Bitmap> asyncTask = new AsyncTask<Void, Void, Bitmap>() { @Override protected Bitmap doInBackground(Void... voids) { try { URL url=new URL(picUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setReadTimeout(5000); connection.setConnectTimeout(5000); int responseCode = connection.getResponseCode(); while (responseCode==200){ InputStream inputStream = connection.getInputStream(); Bitmap bitmap= BitmapFactory.decodeStream(inputStream); return bitmap; } } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Bitmap bitmap) { imageView.setImageBitmap(bitmap); } }; asyncTask.execute();}class ViewHolder{ ImageView imageView; TextView text_title; TextView text_time;}
阅读全文
1 0
- A优化添加图片
- Ueditor上传图片添加a标签
- 添加图片
- 添加图片
- 图片添加
- 图片优化
- 图片优化
- 图片优化
- 图片优化
- 图片优化
- 内存优化--图片优化
- Cocos2D-X射击小游戏(十一)编码9 图片资源优化以及添加音乐
- 图片SEO优化技巧:向站点地图中添加图片信息——来自Google站长管理员工具
- android 添加图片时错误:android libpng error: Not a PNG file
- 给图片添加图片水印
- 前端:图片上添加图片
- QTextEidt添加图片 拖动图片
- 为图片添加水印图片
- Java中的String类常用方法
- Cocos2d-x-3.15.1结合Android Studio2.3.3和Visual Studio2013开发使用简单说明
- 在jsp文件中和js文件中引入图片的方法
- js增加输入框
- 【文档】二、Binlog结构和内容概述
- A优化添加图片
- vue.js学习笔记
- 第四周项目 sec---建设“单链表”算法库
- 【面向HTML--表单】
- Intellij IDEA代码框使用自定义背景图片
- ITON
- 打气球 数学期望
- 正则表达式 re 模块
- 博客编辑中的MarkDown常用操作