title: Open external browser in webview?
body: <p>I am trying to run twitter in webview, but whenever i try to catch external link to open some default browser nothing happens, it's like app has stalled.</p>
  
  <p>Example:- If i click on some blog link inside twitter webview, nothing happens.</p>
  
  <p>I have tried this,</p>
  
  <pre><code> private class InsideWebViewClient extends WebViewClient {
      @Override
      public boolean shouldOverrideUrlLoading(WebView View, String url) {
          if( url.startsWith("https://mobile.twitter.com") || url.startsWith("https://m.twitter.com") ) {
              MoviesFragment.this.progress.setProgress(0);
              View.loadUrl(url);
              return false;
          }
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
          startActivity( intent );
          return true;
      }
  
  
  }
  </code></pre>
  
  <p>but nothing happens, when i try to capture log, there is nothing about webview in it please help.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><em>This time i took a different approach, but still the same result.</em></p>
  
  <p>This time i created a context menu to catch HTML link and then divert them to external browser, but this time also in twitter nothing happens. A popup appears to <code>open in browser</code> after clicking it nothing happens.</p>
  
  <pre><code> @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
  {
      super.onCreateContextMenu(menu, v, menuInfo);
  
      WebView w = (WebView)v;
      WebView.HitTestResult result = w.getHitTestResult();
      if(result.getType() == WebView.HitTestResult.SRC_ANCHOR_TYPE) {
          menu.addSubMenu(0, 0, 0, "open in browser");
      }
  }
  
  @Override
  public boolean onContextItemSelected(MenuItem item){
   if (item.getTitle()=="open in browser") {//open the actual page into using the browser
          myWebView.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(myWebView.getUrl())));
      }
      return true;
  }
  </code></pre>