Rapid Subscribe Android App

Rapid Subscribe Android App
Rapid Subscriber

Breaking News

how to Handle Call Button clicking on a WebView



In Android Programming, When we work with WebView, then we have to handle all clicking actions with it.

For eg., when we click on a call button, then we want our app to go to the phone app. or an app which can handle phone calls.

for that, we use some conditions for it in our, OnPageStarted method,
 public void onPageStarted(WebView view, String url, Bitmap favicon) {  
         progressbar.setVisibility(View.VISIBLE);  
         tooltext.setText(mywebview.getUrl());  
         invalidateOptionsMenu();  
         final String Urls = url;  
   
         if(Urls.contains("mailto:") || Urls.contains("sms:") || Urls.contains("tel:") )  
         {  
           mywebview.stopLoading();  
           Intent i = new Intent();  
           i.setAction(Intent.ACTION_VIEW);  
           i.setData(Uri.parse(Urls));  
           startActivity(i);  
         }  
   
         super.onPageStarted(view, url, favicon);  
       }  

that's it, now we can run our app, and it's done.
Follow us for more posts like this, 
Subscribe Harpreet studio on Youtube  
Like Harpreet Studio on Facebook  
Follow me on Instagram 

No comments