我正在设计一个应用程序,我想在地图上显示特定位置。
我路过String
已放置的地址Google Map
。
以下是我的Intent
code..
String url = "http://maps.google.com/maps?daddr="+address;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
但它给了我谷歌地图来获取方向。我知道为什么会这样,因为我用过daddr
in url
但我不知道在特定位置使用什么..请告诉我在那里使用什么..
我还没有测试过这个,但你可以尝试:
第一种方法:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
EDIT:这可能不适用于 Google 地图 7.0
因此你可以将 uri 更改为:
第二个选项:
String geoUri = "http://maps.google.com/maps?q=loc:" + lat + "," + lng + " (" + mTitle + ")";
where mTitle
是位置的名称。
第三个选项:
geo:0,0?q=my+street+address
第四个选项:
String map = "http://maps.google.co.in/maps?q=" + yourAddress;
希望有效并有帮助:D..
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)