`
bywyu
  • 浏览: 19708 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Only the original thread that created a view hierarchy can touch its views<已解决>

阅读更多

子线程不可以 更新UI主线程

 new Thread() {
	    public void run() {
	        mHandler.sendmessage(new Message());
	    }
 final Handler mHandler = new Handler() {  
	               public void handleMessage(Message msg) {  
	                   super.handleMessage(msg);
	                  //更新具体的线程
                            }  
	           };  
1
0
分享到:
评论

相关推荐

    Android studio :后台修改前台界面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 这句话的意思是:只有创建这个view的线程才能操作这个view 解决方法就是handle 1、 Handler mHandler; 2、 mHandler = new Handler();...

    Android 子线程更新UI

    android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 这个异常为何不是 Only the main thread that created a view hierarchy ...

    开新线程引发的常见3个异常

    2.android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 3.java.lang.RuntimeException: Can't create handler inside thread ...

    详解Android UI更新的几种方法

    如果是在WT进行UI的更新,则会抛出异常,android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.(只有创建这个View的原

    Android消息机制基本原理和使用

    例如在子线程进行耗时较长的下载,等下载完成之后,再去更新UI,提示用户下载完成,直接在子线程里更新UI,会得到报错提示:Only the original thread that created a view hierarchy can touch its views。...

    Android实现在子线程中更新Activity中UI的方法

    本文实例讲述了Android实现在子线程中更新Activity中...ERROR/AndroidRuntime(1222): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its

    Linux 应用和驱动编程基础.

    &lt;br&gt;&lt;br&gt;1 Linux Programming 1&lt;br&gt;1.1 Linux Useful Programming Interfaces ...Thread Interface 4&lt;br&gt;1.1.5 IPC sem Operation Interfaces (InterProcess Communication) 4&lt;br&gt;1.1.6 IPC msg Operation Interfaces ...

    Android View Hierarchy,解决View Hierarchy不能启动

    解决这个启动 View Hierarchy时的这个bug: hierarchy viewer unable to debug device

    为什么能在子线程通过setText进行更新UI

    为什么可以在子线程通过setText进行更新UI ... Only the original thread that created a view hierarchy can touch its views.); } } 一般情况下在子线程更新UI是会报错的,因为在ViewRootImpl

    无线传感器网络仿真

    第一章 无线传感器网络概述 6&lt;br&gt;概述 6&lt;br&gt;1.1 NS-2 6&lt;br&gt;1.2 OPNET 6&lt;br&gt;1.3 SensorSim 7&lt;br&gt;1.4 EmStar 7&lt;br&gt;1.5 GloMoSim 7&lt;br&gt;1.6 TOSSIM 7&lt;br&gt;1.7 PowerTOSSIM 8&lt;br&gt;第二章 OMNET++简介 9&lt;br&gt;概述 9&lt;br&gt;2.1 ...

    The Definitive Guide to ST and JFace

    &lt;p&gt;You'll come to understand the entire class hierarchy of SWT, and you'll learn to use all components in the toolkit with Java code. Furthermore, the book describes JFace, an additional abstraction ...

    visual assist v 10.4.1632 with crack

    (case=9436) &lt;br&gt;STL list&lt;&gt; and vector&lt;&gt; member lists appear correctly following a "using namespace std::list" or "using namespace std::vector" directive. (case=12345) 7226 &lt;br&gt;Empty C++ preprocessor ...

    【Android】CalledFromWrongThreadException 深入源码分析

    在使用 dialog 的时候,因为线程问题,在调用 dismiss() 方法的时候,出现如下常见的 crash–Only the original thread that created a view hierarchy can touch its views.,堆栈信息如下: threadName:main,...

    KDevelop User Manual

    KDevelop User Manual&lt;br&gt;&lt;br&gt;1 WhatThis ManualContains&lt;br&gt;2 Getting Startedwith KDevelop — a GuidedTour 3&lt;br&gt;2.1 AVeryFirstLook at KDevelop . . . . . . . . . . . . . . . . . . . 4&lt;br&gt;2.1.1 ...

    ViewServer-解决View Hierarchy不能启动

    解决The standalone version of hieararchyviewer is deprecated.问题的文件,有源码,也有打好的apk文件

    J2EE API 帮助文档

    All classes&lt;br&gt;API Help&lt;br&gt;Constant Field Values&lt;br&gt;Deprecated API&lt;br&gt;Hierarchy For All Packages&lt;br&gt;

    iOS.Programming.The.Big.Nerd.Ranch.Guide.5th.Edition.01

    Views and the View Hierarchy Chapter 4. Text Input and Delegation Chapter 5. View Controllers Chapter 6. Programmatic Views Chapter 7. Localization Chapter 8. Controlling Animations Chapter 9. ...

    The Elements of Computing Systems

    Unlike other texts that cover only one aspect of the field, The Elements of Computing Systems gives students an integrated and rigorous picture of applied computer science, as its comes to play in the...

Global site tag (gtag.js) - Google Analytics