1. 程式人生 > >【Android】java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'.

【Android】java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'.

ole lang exp blog web ref overflow post exce

一、問題

Java調用JS事件出現

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) {3474c308} called on Looper (JavaBridge, tid 514) {2886ca4f}, FYI main Looper is Looper (main, tid 1) {3474c308})

二、解決方案

https://stackoverflow.com/questions/22607657/webview-methods-on-same-thread-error

http://blog.csdn.net/violetjack0808/article/details/52936157

public Handler handler = new Handler();

handler.post(new Runnable() {

public void run() {

//JS調用

}});

【Android】java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'JavaBridge'.