我有一个目录网站,当我使用移动网络浏览器时,地址链接在Google App Map中打开了,然后在使用我的WebView应用程序尝试相同的时候,它会返回Google Map网站因此它无法解决我的位置。...我想通过Google Map App打开链接...
我在urlhander.java上尝试了此代码:(不起作用)
public static boolean map(Activity mActivity, String url) {
// When user clicks a hyperlink, load in the existing WebView
if(url.contains("http://maps.google.com/"))
{
Uri IntentUri = Uri.parse(url);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, IntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(mActivity.getPackageManager()) != null) {
mActivity.startActivity(mapIntent);
}
return true;
}
return false;
}
尝试使用摘要在您的应用程序中添加WebView:
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");
不要忘记包括Internet许可:
< manifest ... >
<uses-permission android:name="android.permission.INTERNET" />
...
< /manifest >
使用WebView访问Google Maps指南也可能会有所帮助。