【问题标题】:how to display pin on current location in android google map如何在android谷歌地图中的当前位置显示pin
【发布时间】:2014-06-17 11:06:44
【问题描述】:

我正在使用意图在 android 中查找地图上两个地理点之间的路线,我在目标点上得到了 pin,但在我的源位置上没有得到 pin,请告诉我我该怎么做,我的代码是以下: 代码

String uri = "http://maps.google.com/maps?saddr=" + currentLatitude
                    + "," + currentLongitude + "&daddr=" + lat + "," + lng;
            i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
            i.setClassName("com.google.android.apps.maps",
                    "com.google.android.maps.MapsActivity");
            startActivity(i);

【问题讨论】:

    标签: android google-maps android-intent


    【解决方案1】:

    如果您直接导航 Official Google Maps,它将在两个位置上显示 Pin 图。试试下面的另一种方式

    Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?saddr=" + lat + ","+ lng + "&daddr=" + latitude + "," + longitude + ""));
    startActivity(intent);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-29
      • 1970-01-01
      • 1970-01-01
      • 2013-03-27
      • 1970-01-01
      • 2018-03-07
      • 2015-08-14
      相关资源
      最近更新 更多