android异常:android.view.ViewRootImpl$CalledFromWrongThreadException

android异常:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

出现这个异常的原因是你在子线程中修改了主线程中的组件的状态或数据。

android规定:只有在原始线程中(主线程,UI线程)才能修改显示组件。

E/AndroidRuntime: FATAL EXCEPTION: Thread-3 Process: com.example.zfang.course2_1, PID: 31755 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6855) at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1075) at android.view.ViewGroup.invalidateChild(ViewGroup.java:5242) at android.view.View.invalidateInternal(View.java:13574) at android.view.View.invalidate(View.java:13538) at android.view.View.invalidate(View.java:13522) at android.widget.TextView.checkForRelayout(TextView.java:7354) at android.widget.TextView.setText(TextView.java:4479) at android.widget.TextView.setText(TextView.java:4336) at android.widget.TextView.setText(TextView.java:4311) at com.example.zfang.course2_1.fragment.MineFragment$1$1.showProgress(MineFragment.java:89) at com.example.zfang.course2_1.service.DownloadService$1.run(DownloadService.java:86) at java.lang.Thread.run(Thread.java:761) D/EGL_emulation: eglMakeCurrent: 0xa9d850c0: ver 2 0 (tinfo 0xa9d831d0) D/OpenGLRenderer: endAllActiveAnimators on 0x8c994500 (RippleDrawable) with handle 0xa9dff550 W/System.err: java.net.SocketTimeoutException: connect timed out W/System.err: at java.net.PlainSocketImpl.socketConnect(Native Method) W/System.err: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:334) W/System.err: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:196) W/System.err: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) W/System.err: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356) W/System.err: at java.net.Socket.connect(Socket.java:586) W/System.err: at com.android.okhttp.internal.Platform.connectSocket(Platform.java:113) W/System.err:
06-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值