错误详情:
01-30 03:36:52.441 12000-12048/cn.h5 D/@@@: e.ttt:java.lang.RuntimeException: 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) {18b9c7c8} called on Looper (JavaBridge, tid 481) {789820c}, FYI main Looper is Looper (main, tid 1) {18b9c7c8})
当出现以上错误后,处于阻塞状态,无任何效果,出现此错误的原因是:
webView.loadUrl("javascript:show(" + json + ")");
解决方法:
runOnUiThread(new Runnable() {
@Override
public void run() { webView.loadUrl("javascript:show(" + json + ")");
}
});