0

Is there a way to open a URL in an application without using webview? Right now I'm opening a URL in webview using the code below:

startWebView("https://maps.google.com/maps?saddr=" +mGPS.getLatitude() + "," +mGPS.getLongitude() + "&daddr= 28.878444,77.133497&spn=1&t=m");

private void startWebView(String url) {

     //Create new webview Client to show progress dialog
     //When opening a url or click on link

     wv.setWebViewClient(new WebViewClient() {      
         //ProgressDialog progressDialog;

         //If you will not use this method url links are opeen in new brower not in webview
         public boolean shouldOverrideUrlLoading(WebView view, String url) {              
             view.loadUrl(url);

             return true;
         }

         //Show loader on url load
         public void onLoadResource (WebView view, String url) {

         }
         public void onPageFinished(WebView view, String url) {

         }

     }); 

     wv.getSettings().setJavaScriptEnabled(true); 

     wv.loadUrl(url);
 }
Robby Cornelissen
  • 91,784
  • 22
  • 134
  • 156
user3683036
  • 135
  • 1
  • 2
  • 15

1 Answers1

0

If you want to open a url inside your application you'll have to use a WebView.

Shivam Verma
  • 7,973
  • 3
  • 26
  • 34
  • and if i want to open it in other browser then have to use intent right..?? is there any way to use both webview as well as intent in my app?? – user3683036 Jun 26 '14 at 07:40
  • How do you want to use both ? Can you give me a use case ? – Shivam Verma Jun 26 '14 at 07:42
  • in this link the use both webview and intent too http://stackoverflow.com/questions/17994750/open-external-links-in-the-browser-with-android-webview – user3683036 Jun 26 '14 at 07:46
  • Yes. this makes sure that links of only a particular websites opens in your webview. The rest of the links open in the browser. – Shivam Verma Jun 26 '14 at 07:48