My objective is to set auto detection
of phone number
and links
inside a WebView
, and if user doing a long press on number phone for example, a dialog appear to confirm the call
Asked
Active
Viewed 136 times
0

Swayam
- 16,294
- 14
- 64
- 102

AITAALI_ABDERRAHMANE
- 2,499
- 1
- 26
- 31
-
Hope this will help you: [Check This Answer](http://stackoverflow.com/questions/9744390/make-webviews-auto-links-visible) [Check This one also](http://stackoverflow.com/questions/4788461/handling-links-in-a-webview) – Mohit Aug 28 '12 at 08:54
1 Answers
1
This can be done by using following lines of coed.
mWebView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d(TAG,"shouldOverrideUrlLoading url: "+url);
if( url.startsWith("http:") || url.startsWith("https:") ) {
return false;
}
// Otherwise allow the OS to handle it
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
mcContext.startActivity( intent );
return true;
}

Dinesh Anuruddha
- 7,137
- 6
- 32
- 45