title: Android WebView URL intercept , i want to load only one website and it's pages , and nothing else
body: <p>I have a problem , i'm trying to create an app for my website and i'm using android webview to do that, but since there's external links (ads, backlinks.. etc) in my website , when the user clicks these links , the webview opens the links and my app acts like a browser , i know that's what webview is but i want it to open only links of my website</p>
  
  <p>i ovverided the shouldOverrideUrlLoading method and i intercepted the urls 
  and i returned true if the urls are diffrent than my website prefix , but the webview goes all white when i click and external link , and want for the webview is stay the same when i click the external links</p>
  
  <p>here's my code </p>
  
  <pre><code>      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          String host = Uri.parse(url).getHost();
          urlData = url;
  
          if (target_url_prefix.equals(host)) {
              if (mWebviewPop != null) {
                  mWebviewPop.setVisibility(View.GONE);
                  mContainer.removeView(mWebviewPop);
                  mWebviewPop = null;
              }
              return false;
          }
  
      if(!url.contains(getString(R.string.target_url))) {
                  Log.d("intercept External URL", "true");
  
                  return true; 
          }
  
      }
  </code></pre>