【问题标题】:How to get direction of place wherever we touch in map from current location in Android如何从Android中的当前位置获取我们在地图中触摸的任何位置的方向
【发布时间】:2013-08-09 11:57:06
【问题描述】:

我浏览了很多链接,但对于在 Google 地图上获取方向感到困惑。 当我的应用程序启动时,它会显示用户的当前位置,当用户点击地图上的医院标志时,它将显示 5 公里内的所有医院以及用户的当前位置。当用户点击任何地方医院时,他会获得有关它的信息。

现在我的意思是我想显示从当前位置到用户触摸的医院的方向。 我正在使用谷歌地图API of v2

请告诉我完成这项任务的方法......

【问题讨论】:

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


    【解决方案1】:

    试试这个

    try {
            Intent directioIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=" + strSourceLatitude  + "," + strSourceLongitude + "&daddr=" + strDestinationLatitude + "," + strDestinationLongitude));
                directioIntent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
                startActivity(directioIntent);
            } catch (Exception e) {
                Utilities.showToast(GetDirectionActivity.this, "Google Map is not installed on your device.");
            }
    

    【讨论】:

    • :但我想在显示附近医院和当前位置的同一个地图视图上显示方向。
    【解决方案2】:

    查看我写的关于在Google Maps API V2 上绘制Polyline 以绘制从一个位置到另一个位置的方向的博文:

    Google Maps API V2 Directions

    您将找到相关的方法来帮助您入门。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-01
      • 2017-01-09
      • 2020-07-15
      • 2016-07-14
      • 2012-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多