2011-05-16 58 views
0

在我的應用程序中,我想要顯示從當前位置到地圖上給定位置的路線。 任何人都可以告訴我我該如何做到這一點。從當前位置到在地圖上的給定位置的路線android

謝謝。

+1

閱讀這篇文章http://stackoverflow.com/questions/2023669/j2me-android-blackberry-driving-directions-route-between-two-locations/2023685#2023685 – 2011-05-16 05:06:12

回答

0

這是一個很好的方式,但更簡單的方法做到這一點是如果你不介意打開一個意圖是

在瀏覽器中,它調用谷歌地圖或其他導航儀打開URL。

像下面,

Uri uri = Uri 
        .parse("http://maps.google.com/maps?&saddr=" + mCurrentLatitude+","+mCurrentLongitude+"&daddr="+ mLatitude +"," +mLongitude); 
       Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
       startActivity(intent);