문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

You have to implement webviewclient and override the url loading

check this solution

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top