- Code: Select all
http://groups.google.com/group/android-developers/browse_thread/thread/c97fe5d3ff603f03/e44990d079cb2fb2?show_docid=e44990d079cb2fb2&fwc=1
i have the same problem, and not sure on how to destroy/properly exit the webView.
http://groups.google.com/group/android-developers/browse_thread/thread/c97fe5d3ff603f03/e44990d079cb2fb2?show_docid=e44990d079cb2fb2&fwc=1
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.getSettings().setAppCacheEnabled(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);




sa123 wrote:Hi,
I have exactly the same problem with my WebView. I tryed to follow your instructions, but it seems there's something wrong because my webview-threads do not stop.
Could you please post the code of a minimal example in which the webview-threads stop?
Thanx a lot!!!


sa123 wrote:Can you show me code which I can make thema wait?
And can you tell me if the wait-status solves my problem, that the webview becomes slower and slower the more webpages I open after an other? I think this is because the threads are running without stop (or wait)?
private boolean mIsPaused = false;
private void pauseBrowser() {
if (!mIsPaused) {
// pause flash and javascript etc
callHiddenWebViewMethod(mWebView, "onPause");
mWebView.pauseTimers();
mIsPaused = true;
}
}
private void resumeBrowser() {
if (mIsPaused) {
// resume flash and javascript etc
callHiddenWebViewMethod(mWebView, "onResume");
mWebView.resumeTimers();
mIsPaused = false;
}
}
private void callHiddenWebViewMethod(final WebView webview, final String name) {
try {
final Method method = WebView.class.getMethod(name);
method.invoke(webview);
} catch (final Exception e) {
}
}






webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
// Taken from CallbackProxy.java
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
// If another application is running a WebView and launches the
// Browser through this Intent, we want to reuse the same window if
// possible.
intent.putExtra(Browser.EXTRA_APPLICATION_ID, mContext.getPackageName());
try {
mContext.startActivity(intent);
return true;
} catch (ActivityNotFoundException ex) {
// If no application can handle the URL, assume that the
// browser can handle it.
}
// handle this in our WebView
return super.shouldOverrideUrlLoading(view, url);




Return to Other Coding-Problems
Users browsing this forum: Google [Bot] and 8 guests