为了账号安全,请及时绑定邮箱和手机立即绑定

CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views

我在ImageLoader类中创建了Handler 通过message传值,运行程序后可以显示图片,滑动就报错CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views

为什么?

正在回答

2 回答

 是不是在子线程中更新UI了?用Handler,sendMessage方法传给主线程,再用handlerMessage设置图片就好了

0 回复 有任何疑惑可以回复我~
#1

不逃课 提问者

非常感谢!
2016-01-04 回复 有任何疑惑可以回复我~

 是不是在子线程中更新UI了?用Handler,sendMessage方法传给主线程,再用handlerMessage设置图片就好了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Android必学-异步加载
  • 参与学习       50616    人
  • 解答问题       333    个

了解Android中的异步加载处理方法,这是面试问的最多的知识点

进入课程

CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号