Only the original thread that created a view hierarchy can touch its views

Only the original thread that created a view hierarchy can touch its views.

最近在积累自己的Android UI compenent库,在做到自定义相机的时候,点击拍摄按钮,当前的activity会自动finish(),并报以上错误,出错位置在我改变界面组件的visibility属性

rl_resultview.setVisibility(View.VISIBLE);

然后,我做了如下调整,让这部分界面更新在UI主线程中进行

CameraCustomize.this.runOnUiThread(new Runnable() {
    @Override
    public void run() {
        rl_resultview.setVisibility(View.VISIBLE);
    }
});

来源:https://blog.csdn.net/qq_28978893/article/details/80882308

你可能感兴趣的:(Only the original thread that created a view hierarchy can touch its views)