I have a view and view the site has malito code to send email. When I open the link opens in an error. I want that when I open the link opens Gmail app or another email applic
You should update your's WebViewClient with the following:
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
proceedUrl(view, Uri.parse(url))
return true;
}
@TargetApi(Build.VERSION_CODES.N)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
proceedUrl(view, request.getUrl());
return true;
}
private void proceedUrl(View view, Uri uri){
if (uri.toString().startsWith("mailto:")) {
startActivity(new Intent(Intent.ACTION_SENDTO, uri));
} else if (uri.toString().startsWith("tel:")) {
startActivity(new Intent(Intent.ACTION_DIAL, uri));
} else {
view.loadUrl(uri.toString());
}
}