在Android 77.0的系统中,在子线程更新UI界面会产生如下异常:
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views:
可以使用Handler等工具将更新信息发送到主界面,然后通过主界面来更新消息即可,亦可通过如下方法来避免:
runOnUiThread(new Runnable() {
@Override
public void run() {
//更新UI消息
}
});