title: Launching a open a browser when clicking a link in android webview
body: <p>I'm trying to make a link inside my android webview load into one of the web browsers available onto the device. What is happening is that it just loads the link inside the webview. How can I make the link load outside the webview of my application?</p>
  
  <p>The link that I am need to make work is this:</p>
  
  <pre><code>&lt;a href="http://www.testsite.com/linka"&gt;Forgot your password?&lt;/a&gt;
  </code></pre>
  
  <p>When I click it nothing happens, I need it to call the default web browser of the device.</p>
  
  <p>My shouldOverrideUrlLoading is currently being used to check the URL and loads another activity if it is  equal:</p>
  
  <pre><code>public boolean shouldOverrideUrlLoading(WebView view, String url) {
      Log.d("extraData", "the urls"+Uri.parse(url).getPath());
      if (Uri.parse(url).getPath().equals("/qr_code")) {
          progress.setVisibility(View.GONE);
            Intent intent = new Intent(getApplicationContext(),QRActivity.class);               
          startActivityForResult(intent, 1);
        setContentView(R.layout.activity_qr);        
  
          //return true;
      }
          if(Uri.parse(url).getPath().equals("/linka")){
              return true;
          }
  
      return false;
  }
  </code></pre>
  
  <p><strong>Update:</strong> It is now working but for some reason my current webView still runs the link therefore the pages loads to the link clicked</p>
  
  <pre><code>private class MyBrowser extends WebViewClient {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          Log.d("extraData", "the urls"+Uri.parse(url).getPath());
          if (Uri.parse(url).getPath().equals("/TMMobile/Main/qr_code")) {
              //return true;
          }
          if(Uri.parse(url).getPath().equals("/linka")){
              Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://testdomain/RecoverPassword.aspx"));
              startActivity(browserIntent);
          }
          return false;
      }
  }
  </code></pre>