您的位置:首页 > 移动开发 > Android开发

android开发 WebViewjava.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebVie

2016-07-25 14:10 531 查看
项目中用到java和js交互,js调用java方法,让webView刷新网页,异常信息如下:

java.lang.Throwable: A WebView method was called on thread 'JavaBridge'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {c44f280} called on Looper (JavaBridge, tid 26651) {a2bc55}, FYI main Looper is Looper (main, tid 1) {c44f280})


解决办法:

在Activity里面的调用方法执行代码采用这种方式写:

/**
* 刷新webView 我的商品
*/
public void refreshWebViewGoods() {
runOnUiThread(new Runnable() {
@Override
public void run() {
goods.refurbishWebViewGoods();
}
});
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android开发 WebView