@Override ShouldOverrideUrlLoading

AndreLuiiz Feb 21st, 2020 (edited) 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Coloque esse código em seu mWebView.setWebViewClient(new WebViewClient().
  2. Isso fará com que os links como tel:, whatsapp:, mailto:, etc funcionem perfeitamente.
  4. @Override
  5.         public boolean shouldOverrideUrlLoading(WebView wv, String url) {
  6.             if(url.startsWith("tel:") || url.startsWith("whatsapp:")) {
  7.                 Intent intent = new Intent(Intent.ACTION_VIEW);
  8.                 intent.setData(Uri.parse(url));
  9.                 startActivity(intent);
  10.                 return true;
  11.             }
  12.             return false;
  13.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand