Open dialer example

suggest change

If the web page contains a phone number, you can place a call with the phone's dialer. This code checks for a URL that starts with tel:, then creates an intent that opens the dialer for that number. It returns true for every URL, so schemes other than tel:, http:, and https: are not loaded.

public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("tel:")) { 
            Intent intent = new Intent(Intent.ACTION_DIAL,
                    Uri.parse(url)); 
            startActivity(intent); 
    }else if(url.startsWith("http:") || url.startsWith("https:")) {
        view.loadUrl(url);
    }
    return true;
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents