Question

I want to load the google maps direction link to a webview inside the app. But when i load them it forces me to choose with what app it should open the direction.

webview = (WebView) findViewById(R.id.webView);
String url = String.format("http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f", getIntent().getDoubleExtra("start_lat", 0),
             getIntent().getDoubleExtra("start_lng", 0),
             getIntent().getDoubleExtra("end_lat", 0),
             getIntent().getDoubleExtra("end_lng", 0));
webview.loadUrl(url);

This forces me to choose if i want to open with google maps or with the phone browser app. I want to let the app to load the direction url in my app, not an external app.

Was it helpful?

Solution

You should use

http://developer.android.com/reference/android/webkit/WebViewClient.html#shouldOverrideUrlLoading(android.webkit.WebView,java.lang.String)

And override the loading of the URL to continue loading it within the webview.

OTHER TIPS

You have to implement webviewclient and override the url loading

check this solution

https://stackoverflow.com/a/11859770/3518278

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top