only the original thread that created a view hierarchy can touch its views解决方案
Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
此错误是在非UI线程中更新UI所造成的,解决方案如下:(注:在需要更新UI的地方调用new LongTimeTask().execute("此处为任意字符或空均可");)
private class LongTimeTask extends AsyncTask<String, Void, String> {@Overrideprotected String doInBackground(String... params) {return params[0];}@Overrideprotected void onPostExecute(String result) {//更新UI的操作,这里面的内容是在UI线程里面执行的}}
only the original thread that created a view hierarchy can touch its views解决方案相关推荐
- android开发 bug问题解决:Only the original thread that created a view hierarchy can touch its views
android开发 bug问题解决: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——Handler的使用
今天写了一个更新UI的小例子,没想到出了log打印了这样一个错误:Only the original thread that created a view hierarchy can touch it ...
- Only the original thread that created a view hierarchy can touch its views异常
写代码的时候碰到android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that crea ...
- android报错:Only the original thread that created a view hierarchy can touch its views.
问题的报错位置是我用handler写了一个定时消息,在handleMessage()方法里直接写了ui更新操作, 这个报错的原因一般是因为在子线程中直接操作UI导致的(eg, setText()).因 ...
- 出现Only the original thread that created a view hierarchy can touch its views.的错误
先看这句话的翻译哈.只有创建视图层次结构的原始线程才能触摸其视图. 一般这种错误出现在子线程中操作主线程的控件的操作中,比如更新等操作. 解决这类问题,需要使用Handler.关于Handler是什么 ...
- Only the original thread that created a view hierarchy can touch its views
今天发现一个界面setText 的时候出现了这个问题,看到报错,大致就是界面还没创建呢,就使用seText 了 这个是自己的理解, 处理方法就是 添加一个延时操作, runOnUiThread(new ...
- Only the original thread that created a view hierarchy can touch its views.
这个问题是由于再非主线程中更新了Android的UI,找到可能是在非主线程更新UI的方法,使用使其再handler中更新ui,问题基本上就能够解决. 转载于:https://www.cnblogs.c ...
- Android刷新UI导致崩溃的探究——Only the original thread
一.原因: 非主线程使用TextView.setText(),"有时会出现"Only the original thread that created a view hierarc ...
- tip use view.isineditmode() in your custom views to skip code when shown in eclipse
tip use view.isineditmode() in your custom views to skip code when shown in eclipse 转载于:https://www. ...
最新文章
- 大家都来说说为什么要学习jQuery Mboile?
- ECSHOP头部调用会员的消费积分
- objective c 语法
- OpenCV为轮廓创建边界旋转框和椭圆
- 我被“非结构化数据包围了”,请求支援!
- echart 地图 某个地区_一站式解决echarts实现区域地图
- 从下列选项中选择正确的java表达式,java笔试常见的选择题
- [项目管理]项目管理常用的七大工具
- windows 域,windows domain
- 两个坚持是什么_坚持跑步八年,90后大学生告诉你,坚持锻炼的意义
- 计算机与英语相关工作,计算机行业岗位英语单词整合
- python小游戏:添加武器,查看武器,删除武器
- 博弈美业SAAS系统,美业系统源码-主要功能
- 2022年9月电子学会Python等级考试试卷(一级)答案解析
- docker-镜像加速
- 内蒙古计算机考研学校选择,2020内蒙古考研指南-这些没有A+的院校你会选择吗...
- 计算机音乐谱大全好汉歌,好汉歌简谱-刘欢-电视剧《水浒传》主题曲
- 联想p720装系统_“多达112个框”:Lenovo 联想 推出 ThinkStation P920/P720系列 工作站...
- EasyExcel大批量数据导出OOM,个人案例和解决办法
- icode 三级训练场if入门1-10关