在子线程中如何更新ui

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

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