android studio 线程安全Only the original thread that created a view hierarchy can touch its views
来源:互联网 发布:炒股软件接口 编辑:程序博客网 时间:2024/04/30 14:26
在加载bitmap时遇到系统线程报错,通过参考https://developer.android.com/guide/components/processes-and-threads.html#Processes
解决了问题,代码:
public static void setPic(final ImageView ivPic, final String pic_url){ new Thread(new Runnable() { @Override public void run() { try { HttpURLConnection urlConnection=(HttpURLConnection)new URL(pic_url).openConnection(); urlConnection.connect(); InputStream is=urlConnection.getInputStream(); final Bitmap bitmap= BitmapFactory.decodeStream(is); ivPic.post(new Runnable() { @Override public void run() { ivPic.setImageBitmap(bitmap); } }); is.close(); } catch (IOException e) { e.printStackTrace(); } } }).start();
0 0
- android studio 线程安全Only the original thread that created a view hierarchy can touch its views
- Android Only the original thread that created a view hierarchy can touch its views.
- Android单元测试 Only the original thread that created a view hierarchy can touch its views.
- android:Only the original thread that created a view hierarchy can touch its views
- Android 解决Only the original thread that created a view hierarchy can touch its views异常
- 【Android】错误信息 Only the original thread that created a view hierarchy can touch its views
- android子线程控制UI线程,以防:Only the original thread that created a view hierarchy can touch its views.
- android中用线程更新UI,报错only the original thread that created a view hierarchy can touch its views
- Only the original thread that created a view hierarchy can touch its views的相关
- 报Only the original thread that created a view hierarchy can touch its views错误解决
- Only the original thread that created a view hierarchy can touch its views错误
- 报Only the original thread that created a view hierarchy can touch its views错误解决
- 报Only the original thread that created a view hierarchy can touch its views错误解决
- Only the original thread that created a view hierarchy can touch its views错误相关
- Only the original thread that created a view hierarchy can touch its views的相关
- Only the original thread that created a view hierarchy can touch its views
- 关于Only the original thread that created a view hierarchy can touch its views的解决方案
- Only the original thread that created a view hierarchy can touch its views.
- 评价人工神经部分
- c#学习笔记之获取当前路径
- Xcode的Product Name、Bundle Name、Bundle Display Name区别
- ajax提交数据到后台php接收
- 图论 BFS HDU 1175
- android studio 线程安全Only the original thread that created a view hierarchy can touch its views
- 你说 后来
- 前端js+ajax+css/后端springMVC项目1总结
- mySQL数据库
- 【转载】XCode工程中 Project 和 Targets区别
- 机器学习中常用到的知识点总结
- php的pdo数据层mysql类
- HDU 1671 Phone List 字典树(Trie)
- 3.Redis keys 命令