La mia vista Web non sta chiamando la funzione javascript che sta restituendo avvisi come di seguito. Qualcuno può suggerire come sbarazzarsi del seguente avviso.I metodi WebView non vengono chiamati in Android
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.
Qui di seguito è la mia funzione.
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;
}
È la stessa cosa nel problema che se avessi chiamato i metodi di WebView in AsyncTask, non funzionerebbe? –
Questa risposta è accettata e non vedo setJavaScriptEnabled() o altri metodi per l'istanza di WebView. – seema
Immagino che tu sia su una versione più recente di Android. Questo post è stato pubblicato su Android 2.3.3 penso. Non ne sono affatto sicuro. Nelle versioni più recenti è necessario utilizzare il seguente codice: 'wv.getSettings(). SetJavaScriptEnabled (true)'. spero che questo risolva il tuo problema – ZeusNet