2013-02-14 74 views
0

我正試圖在兩個位置之間找到地圖方向。 源位置是設備位置。 目標位置是我維護的數據庫。 這是我的代碼。 我能夠達到我選擇公交車,火車,地鐵 的屏幕,但我得到像找到沒有路線的結果。 我可以在From字段 以及經緯度 中看到「我的位置」。以下是我獲取方向的代碼。通過意圖獲取地圖方向時未找到路線

protected void getDirections() { 
    // TODO Auto-generated method stub 
    double dlongtd =result.get(0).getLongitude() ,dlattd=result.get(0).getLatitude(); 
    Intent intent = new Intent(Intent.ACTION_VIEW, 
      Uri.parse("http://maps.google.com/maps?f=d&daddr="+dlongtd+","+dlattd)); 
     intent.setComponent(new ComponentName("com.google.android.apps.maps", 
      "com.google.android.maps.MapsActivity")); 
    startActivity(intent); 
} 

此對話框中,我得到 ,當我點擊任何過境一個我沒有得到任何擊潰發現土司 enter image description here

回答

2

的一個錯誤,我做到了以上 我經過經度,而不是緯度副versa.Everything工精細現在

更新的代碼:

protected void getDirections() { 
    // TODO Auto-generated method stub 
    double dlongtd =result.get(0).getLongitude() ,dlattd=result.get(0).getLatitude(); 
    Intent intent = new Intent(Intent.ACTION_VIEW, 
      Uri.parse("http://maps.google.com/maps?f=d&daddr="+dlattd+","+dlongtd)); 
     intent.setComponent(new ComponentName("com.google.android.apps.maps", 
      "com.google.android.maps.MapsActivity")); 
    startActivity(intent); 
} 
+0

有什麼辦法,我們可以用我們選擇的詞來掩蓋盒子的經度和緯度......? – 2013-02-14 21:01:00

+0

我犯了同樣的錯誤 – Anirudh 2016-12-17 07:29:41

相關問題