在子线程中如何更新ui

时间:2022-12-25 05:10:55

android不能在子线程中更新ui,否则会出现android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.异常。

如果要在子线程中更新Ui,可以使用handler和Activity.runOnUiThread(Runnable)来实现



相关文章