How to make links open within webview or open by default browser depending on domain name?
<p>I have WebView in which I want to open links belong to domain www.example.org in webview while all other links (if clicked) open by the default browser outside of my application.</p>

<p>I tried to use public boolean shouldOverrideUrlLoading(WebView view, String url)  but it does not work properly.</p>

<p>Here is the code that does not work:</p>

<pre><code>public class MyWebViewClient extends WebViewClient {
    @Override
               public boolean shouldOverrideUrlLoading(WebView view, String url) {
                   try {
                   URL urlObj = new URL(url);
                   if (urlObj.getHost().equals("192.168.1.34")) {
                       view.loadUrl(url);
                       return true;
                   } else {
                       view.loadUrl(url);
                       return false;
                     }
                   } catch (Exception e) {

                   }
               }
}
</code></pre>

<p>In both cases ( return true and return false) the URL is handled by my application.</p>
