07-30 10:15:44.031: W/webview_proxy(3770): java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
My Web view is not calling the javascript function it is returning warning like below. Can anybody suggest how to get rid of the below warning.
07-30 10:15:44.031: W/webview_proxy(3770): java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
Below is my function.
public boolean onLongClick(View v){
System.out.println("dfdsf");
// Tell the javascript to handle this if not in selection mode
//if(!this.isInSelectionMode()){
this.getSettings().setJavaScriptEnabled(true);
this.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.getSettings().setPluginsEnabled(true);
this.loadUrl("javascript:android.selection.longTouch();");
mScrolling = true;
//this.setJavaScriptEnabled(true);
//}
// Don't let the webview handle it
return true;
}
The warning is telling you everything. You are calling the webview methods directly. That means you are calling them on WebViewCoreThread. You have to call them on the UI Thread that means in the Activity which uses this webview.
Is it same thing in the problem that if I called any WebView methods in AsyncTask, then it will not work? –
David DimalantaOct 3 '13 at 7:38
This is accepted answer and I cant see setJavaScriptEnabled() or other these methods for WebView instance. –
seemaAug 20 '15 at 12:10
I guess you are on a newer version of Android. This post was published on Android 2.3.3 i think. I'm not sure at all. In the newer versions you have to use the following code:wv.getSettings().setJavaScriptEnabled(true). Hope this solves your problem –
ZeusNetAug 24 '15 at 8:47
My Web view is not calling the javascript function it is returning warning like below. Can anybody suggest how to get rid of the below warning.
07-30 10:15:44.031: W/webview_proxy(3770): java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
Below is my function.
public boolean onLongClick(View v){
System.out.println("dfdsf");
// Tell the javascript to handle this if not in selection mode
//if(!this.isInSelectionMode()){
this.getSettings().setJavaScriptEnabled(true);
this.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.getSettings().setPluginsEnabled(true);
this.loadUrl("javascript:android.selection.longTouch();");
mScrolling = true;
//this.setJavaScriptEnabled(true);
//}
// Don't let the webview handle it
return true;
}
The warning is telling you everything. You are calling the webview methods directly. That means you are calling them on WebViewCoreThread. You have to call them on the UI Thread that means in the Activity which uses this webview.
Is it same thing in the problem that if I called any WebView methods in AsyncTask, then it will not work? –
David DimalantaOct 3 '13 at 7:38
This is accepted answer and I cant see setJavaScriptEnabled() or other these methods for WebView instance. –
seemaAug 20 '15 at 12:10
I guess you are on a newer version of Android. This post was published on Android 2.3.3 i think. I'm not sure at all. In the newer versions you have to use the following code:wv.getSettings().setJavaScriptEnabled(true). Hope this solves your problem –
ZeusNetAug 24 '15 at 8:47
wv.getSettings().setJavaScriptEnabled(true)
. Hope this solves your problem – ZeusNet Aug 24 '15 at 8:47