How to intercept loading URLs inside your WebView.
- Let's assume you have a WebView available in your activity, like this:
mWebView = (WebView) findViewById( R.id.mywebview);
- Now you can override the shouldOverrideUrlLoading method like this:
mWebView.setWebViewClient(new WebViewClient(){...
@Override public boolean shouldOverrideUrlLoading(WebView view,
String url)
{ - That's it. Each time a link is clicked on your WebView, it will call your shouldOverrideUrlLoading method. The method should return true if the URL was acted upon, or false otherwise.







