有没有办法在不使用webview的情况下在应用程序中打开URL?现在我使用以下代码在webview中打开一个URL:
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);
}
答案 0 :(得分:0)
如果要在应用程序中打开网址,则必须使用WebView。