webview.loadUrl("about:blank") issue

android, webview

Solution

use `webView.clearView();` before loading the new URL.

also use There are a couple of things you can do to clear the webview depending exactly what you want to do:

webView.clearCache(true);

webView.clearHistory();

webView.destroy();

Problem

In my application I have a webview in which initially I load any website, say www.google.com. Later on a button click I want to clear this webview, for which I do ``` webview.loadUrl("about:blank"); ``` But doing this does not clear my webview, it continues to display google.com I tried to re initialize the webview as ``` webview = new WebView(this); webview.loadUrl("about:blank"); ``` I also tried ``` webview.clearHistory(); webview.loadUrl("about:blank"); ``` But I got the same results, the webview displays google.com How can I clear the webview? Please suggest. Thank You. Edit: On the other hand, before loading google.com if I do ``` webview.loadUrl("about:blank"); ``` it loads a blank webpage.

Original source