android - How to make a phone call from webview
2015-05-07 11:04
716 查看
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; }
转载:http://stackoverflow.com/questions/9408378/android-how-to-make-a-phone-call-from-webview
OK so I solved the issue I think. I just needed to separate the URL overrides as follows:
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; }
Now my regular links work as well as the tel links. I can also add in there for geo: links if I need to and it will not give me the issue that I was having before to open up maps on the phone.
参考:http://stackoverflow.com/questions/4338305/android-webview-tel-links-show-web-page-not-found
相关文章推荐
- how to implement gesture detector onfling in webview in android - Stack Overflow
- Android WebView blocks redirect from https to http
- how to get toolchain from android source -make windows sdk
- How to make a call in Windows Phone 7 application
- How to pass ViewState value from web form page to web user control page?
- how to call javascript function in webview
- Android, How to get redirection event in WebView?
- [Android 問題] How to Activate Multi-Touch in WebView (for Web Browser, Google Map, etc)?
- [WebView] How to display local images from a remotely loaded URL web page?
- How to call function from register view
- How to call a android/native service from a native/android (java) code
- How to call javascript from Android?
- [iOS/Android开发之WebService]How to write a webservices using php with json format
- Android Run Time: An Easy Hack To Make Your Phone Faster And Its Battery Last Longer
- Android重写view时onAttachedToWindow () 和 onDetachedFromWindow ()
- How to get UITableView from UITableViewCell?
- How to get byte array from imageview
- How to Make Custom Drawn Gradient Backgrounds in a Grouped UITableView with Core Graphics
- How to unlock xcode file to make edits from different computers?