使用坐标在Google地图上查找位置

时间:2012-10-18 12:05:00

标签: android google-maps

我想根据纬度和经度坐标在地图上显示一个位置。当我按下按钮时,我想将坐标发送到谷歌地图(或其他应用程序)并确定该位置。关于如何实现这一目标的任何想法?

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

如果要为Google地图上的特定点设置动画,则需要定义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

答案 2 :(得分: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);