Java_com_android_org_chromium_base_SystemMessageHandler_nativeDoRunLoopOnce


Java_com_android_org_chromium_base_SystemMessageHandler_nativeDoRunLoopOnce

Android 中 webView 调用 JS 出错的解决办法

问题代码:

1
2
3
4

public void save(String data){
webView.loadUrl("javascript: alert(" + data +")");
}

解决办法:

1
2
3
4
5
6
7
8
public void save(String data){           
webView.post(new Runnable() {
@Override
public void run() {
webView.loadUrl("javascript: alert(" + data +")");
}
});
}