本文介绍了让Android的路线和导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用的谷歌API2 - 地图,让导航到指定的地方
我搜索标签添加想要去的地方
但不能使导航吧。
how to use google-maps on API2 to get navigation to specified placei've add a search tab to get placesbut can't make navigation to it
推荐答案
我用下面的code在我的应用程序,它运行正常。
I have used the following code in my application and it runs fine.
在这里,
SADDR =源地址(纬度,经度)
DADDR =目标地址(纬度,经度)
请注意,您还可以通过地址字符串中纬度/经度代替。
Note that you can also pass Address string in stead of lat/lng.
public void showDirections(View view) {
final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr="+ latitude + "," + longitude + "&daddr=" + latitude + "," + longitude));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);
}
希望这将有助于...
Hope this will help...
这篇关于让Android的路线和导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!