Only the original thread that created a view hierarchy can touch its views
来源:互联网 发布:interbase数据库 编辑:程序博客网 时间:2024/06/06 04:29
Android线程的问题
public class MainActivity extends Activity implements View.OnClickListener { private static final int COMPLETED = 0; private TextView stateText; private Button btn; private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == COMPLETED) { stateText.setText("completed"); } } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); stateText = (TextView) findViewById(R.id.tv); btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(this); } @Override public void onClick(View v) { new WorkThread().start(); } //工作线程 private class WorkThread extends Thread { @Override public void run() { //......处理比较耗时的操作 //处理完成后给handler发送消息 Message msg = new Message(); msg.what = COMPLETED; handler.sendMessage(msg); } } }
阅读全文
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 图片毛玻璃的实现方法
- MySQL学习之三:select语句
- mysql的事件
- get和post方式能提交数据量大小比较
- 大牛的深度学习面试经验
- Only the original thread that created a view hierarchy can touch its views
- 如何抓取关机闹钟(Poweroff Alarm)相关log?
- 树莓派-wiringPi-GPIO
- 【Scikit-Learn 中文文档】使用 scikit-learn 介绍机器学习 | ApacheCN
- 多线程下载+断点续传+播放视频
- AngularJs实现购物车
- BZOJ1004:[HNOI2008]Cards (Burnside引理+DP+Exgcd)
- 自定义注解
- linux下操作mysql