Only the original thread that created a view hierarchy can touch its views.
来源:互联网 发布:程序员专用显示器 编辑:程序博客网 时间:2024/05/21 06:49
今天写的时候犯了个低级错误,就是在子线程更新了UI,如下,切记
class CatchTask extends TimerTask
{
public void run()
{
if(p!=null)
{
p.destroy();
}
if(i<1)//控制值循环一次
{
handleBit();//获取用户输入的字节数
cmd.setBit(defaultBit);//设置
p=cmd.catchPackage();//抓取
}
else
{
MyApplication.message= MyApplication.mhandler.obtainMessage();
MyApplication.message.what=1;
MyApplication.mhandler.sendMessage(MyApplication.message);//告诉主线程,自动抓取完成
timerCatch.cancel();
if(p!=null)
{
p.destroy();
}
}
i++;
et.setText("OK");//令textview显示的字变化。这里就是错的根源,看起来很对,然而这就是忘记了不能再非UI进程更新的问题。
}
//
}
0 0
- 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
- 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.
- Android新手入门2016(13)--阻塞对话框PopupWindow
- Linux内核源码分析方法
- 【LeetCode】131.Palindrome Partitioning回文划分
- youtube下载视频好工具插件
- Linux apache安装
- Only the original thread that created a view hierarchy can touch its views.
- poj3624 Charm Bracelet(01背包)
- 多线程——Java多线程实现的三种方式
- 多个控件跑马灯效果
- Red Hat 7.2 配置使用CentOS 7.2 Yum 源
- 原创:为iOS和OSX开发VPN的九九八十一难
- eval函数
- iOS开发模式之单例模式
- 第四周项目3-随机数应用于游戏