2012-05-06 22 views
1

我正在構建一個Android應用,並且我想讓Google地圖Api支持從點A到B的路由。到目前爲止,我設法實現了Google地圖並將其顯示在該應用程序,如果任何人可以解釋如何添加「方向」,這將是偉大的。在Android上使用谷歌地圖進行路由

+0

這裏是你的代碼?顯示你的努力..... –

回答

1

使用意向

String uri = "http://maps.google.com/maps?saddr=" +sourcelat+","+sourcelon+"&daddr="+destlat+","+destlon; 
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); 
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); 
startActivity(intent); 

而另一個使用代碼下載sourcecode

+0

如果你想把它放在你自己的地圖實現你的運氣。這是Google地圖目前唯一支持的方式。或者看看osmdroid或類似的。 – Warpzit

+1

http://code.google.com/p/j2memaprouteprovider/source/browse/trunk/J2MEMapRouteAndroidEx/?r=8 –

+0

這裏下載完整的代碼http://www.mediafire.com/download.php?t8idm6zapac7cal –