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中相关的view和控件不是线程安全的,我们必须单独做处理。
处理方法:

private static final Handler handler = new Handler(Looper.getMainLooper());

      handler.post(new Runnable() {
            @Override
            public void run() {
                //代码逻辑
            }
        });