When is shouldOverrideUrlLoading
method called?
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
}
});
- Is it called during initial loading of url? e.g.
webView.loadUrl( "file:///android_asset/html/index.html");
- Is it called everytime URL of webview changes?
Any reference? I didn't find one. Thanks
Below is the answer for your both the questions:
As per the document, it will manage every time new URL is about to load in current WebView.
It does however, get called when the WebView to load a different URL from the one the user had requested.
Calling
loadUrl()
will also trigger theshouldOverrideUrlLoading()
method. (Only when a new url is about to be loaded.)Ref : public boolean shouldOverrideUrlLoading (WebView view, String url)