关于Calling View methods on another thread than the UI thread的错误

来源:互联网 发布:golang ide 编辑:程序博客网 时间:2024/05/29 18:50

唉,今天又碰到一坑,在原生的界面使用分享没一点问题,各项正常,然后加载webview的时候,在webview中去进行分享,QQ,微信等都没问题,但是微博分享却尼玛报错,心里一万只草泥马~~控制台抛出Calling View methods on another thread than the UI thread此异常,一看名字UI,thread,心里猜想这应该是UI线程问题,然后网上找找资料一看果然如此,因为在webview中调用微博不属于UIthread,所以解决办法就是如下

if(TextUtils.isEmpty(shar_native)){    mActivity.runOnUiThread(new Runnable() {        @Override        public void run() {            performShare(SHARE_MEDIA.SINA);        }    });

0 0
原创粉丝点击