`
阅读更多
10-22 19:16:39.231: E/RetryHandler.retryRequest(L:91)(5718): retry error, curr request is null
10-22 19:17:47.121: E/AndroidRuntime(5718): FATAL EXCEPTION: Thread-1087
10-22 19:17:47.121: E/AndroidRuntime(5718): Process: com.foxhis.activity, PID: 5718
10-22 19:17:47.121: E/AndroidRuntime(5718): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6193)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:900)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.requestLayout(View.java:16431)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:352)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.setFlags(View.java:8908)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at android.view.View.setVisibility(View.java:6036)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at com.foxhis.untils.ProcessResult.hideAlert(ProcessResult.java:69)
10-22 19:17:47.121: E/AndroidRuntime(5718): 	at com.foxhis.activity.fragment.GuestInfo_order_detailFragment$3.run(GuestInfo_order_detailFragment.java:296)

 

  android 开发常出现类似的错误。

  原因是:View控件的操作只能在主线程操作。 如果改成在其他线程中处理就会报上面的错误。

  eg:

new Thread(){
				public void run() {
					Message msgMessage = xHandler.obtainMessage(what);
					xHandler.sendMessage(msgMessage);
                                        testView.setVisibility(View.GONE);
				}
			}.start();

 

 

 

 

0
0
分享到:
评论

相关推荐

    问题:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original

    问题:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a 我的场景是 LinearLayout.LayoutParams params11 = new LinearLayout.LayoutParams(264, LinearLayout....

    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实现在子线程中更新Activity中UI的方法

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

    详解Android UI更新的几种方法

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

    【Android】CalledFromWrongThreadException 深入源码分析

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

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

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

Global site tag (gtag.js) - Google Analytics