2012-10-18 41 views
1

我想根據經度和緯度座標顯示地圖上的位置。當我按下按鈕時,我想將座標發送到Google地圖(或其他應用程序)並查明該位置。任何想法如何我可以實現這一點?使用座標在Google地圖上查找位置

+0

你是什麼意思找到位置?你想動畫到某個位置? – Carnal

+0

在谷歌地圖上查找「32.297581,-64.775734」 – PKeidel

+0

想要了解該位置的地址名稱或地點? – Lokesh

回答

1

我已經找到了一個簡單的解決方案。我通過意向啓動谷歌地圖應用

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
         Uri.parse("http://maps.google.com/maps?q=" + serviceActivity.Latitude.toString() + "," + serviceActivity.Longitude.toString())); 
         startActivity(intent); 
+0

非常簡單和完美..謝謝你+1 – Noman

1

如果要動畫到一個特定的點,你需要一個谷歌地圖上定義一個MapView。然後創建一個MapController和動畫到特定的GeoPoint:

MapController mapController = mapView.getController(); 

double lat = latitude * 1e6; 
double lon = longitude * 1e6; 

GeoPoint startpoint = new GeoPoint((int) lat, (int) lon); 
mapController.animateTo(startpoint); 

試試這個教程:MapView Tutorial

相關問題