【问题标题】:Google map doesn't show correct location谷歌地图没有显示正确的位置
【发布时间】:2013-02-05 20:05:11
【问题描述】:

不久前,我更新了我的应用程序中的地图类以使用 Google Maps Android API v2。在我的应用程序中,我使用类 Location 来保存我当前的位置。当我尝试使用代码在地图上添加带有我的位置的标记时:

Log.e(tag,"adding user_marker at lat = " + Common.curLocation.getLatitude() 
+ ",lng = " + Common.curLocation.getLongitude());
User_Curr_Position = new LatLng(Common.curLocation.getLatitude(),
  Common.curLocation.getLatitude());
mUser_Curr_Position_Marker = mMap.addMarker(new 
MarkerOptions().position(User_Curr_Position).title("Your Position").draggable(true));

它给了我错误的位置(在深海的某个地方)。我通过从日志中获取 lat 和 long(“在 lat=32.165603,lng=34.81224 处添加 user_marker”)检查了我没有输入错误的参数,并在谷歌地图(在互联网上)上找到了正确的位置。 谁能告诉我我做错了什么?

【问题讨论】:

    标签: android google-maps google-maps-api-2


    【解决方案1】:

    好吧,您将用户的纬度作为经度传入。

    User_Curr_Position = new LatLng(Common.curLocation.getLatitude(),  Common.curLocation.getLatitude());
    

    应该是的

    User_Curr_Position = new LatLng(Common.curLocation.getLatitude(),  Common.curLocation.getLongitude());
    

    【讨论】:

    • 有时其他人可以一直看到你面前的东西......我的错误......thx
    猜你喜欢
    • 1970-01-01
    • 2013-11-14
    • 1970-01-01
    • 1970-01-01
    • 2018-02-11
    • 1970-01-01
    • 2012-05-03
    • 2015-12-07
    • 1970-01-01
    相关资源
    最近更新 更多