Rapid Subscribe Android App

Rapid Subscribe Android App
Rapid Subscriber

Breaking News

how to validate and create a google search with your URL



If you are creating an app for Android, and create a Web Browser app, then you have to create a google search in your browser app and also validate that URL.

so here's the code for validating your URL.
 private void ValidateUrl(String url) {  
     String prefix = "https://www.google.com/search?q=";  
   
     if(!url.startsWith("http://") && !url.startsWith("https://")&&  
     !url.endsWith(".com"))  
     {  
       url=prefix+url;  
     }  
     if(url.endsWith(".com") || url.endsWith(".as") || url.endsWith(".uk") || url.endsWith(".biz"))  
     {  
       if(!url.startsWith("http://") && !url.startsWith("https://"))  
       {  
         url = "https://"+url;  
       }  
     }  
     mywebview.loadUrl(url);  
   
   }  

Here, your URL is a value you get from your EditText.

and use this method where you want.
Follow us for more posts like this, 
Subscribe Harpreet studio on Youtube  
Like Harpreet Studio on Facebook  
Follow me on Instagram 

No comments