您的位置:首页 > 其它

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

2014-01-01 22:52 645 查看
Only the original thread that created a view hierarchy can touch its views 从字面就知道是由于没在主线程中更新UI所导致的,解决方案也很简单,只要加handler就好了。

比如我自己的应用环境:

private Handler handler =
new Handler() {
public
void handleMessage(Message msg) {
body.setText("");
// 关闭ProgressDialog
progressDialog.dismiss();
}
};

调用handler:

handler.sendEmptyMessage(0);

只是很简单的一个小问题,之前没留意。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐