【问题标题】:Android: Launching google map with intent how to mark a specific locationAndroid:启动谷歌地图,意图如何标记特定位置
【发布时间】:2011-10-14 08:31:53
【问题描述】:

我正在使用提供纬度和经度的意图启动 googlemap。 它显示了指定位置周围区域的地图。

如何在启动地图时在此特定位置显示标记。

这是我开始活动的代码:

Intent i = new Intent(android.content.Intent.ACTION_VIEW,
                        Uri.parse("geo:" + lat+ "," + long+ "?z=10"  ) )
startActivity(intent);

【问题讨论】:

  • @preeta 您需要使用意图还是不使用意图来放置标记?
  • 我想这样做。它适用于 mapactivity 和 webview,但这里的要求是特定于意图和启动活动

标签: android


【解决方案1】:

要放置标记,只需使用以下示例:

// change name - to any text you want to display
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:55.74274,37.56577?q=55.74274,37.56577 (name)"));
// the following line should be used if you want use only Google maps
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);

【讨论】:

    【解决方案2】:

    你必须使用静态地图api...检查这个..如果无法正常工作,有链接可以显示mapview,你应该添加webview和loadurl它工作正常......

    http://code.google.com/apis/maps/documentation/staticmaps/#Markers

    【讨论】:

      猜你喜欢
      • 2019-02-08
      • 1970-01-01
      • 2019-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-18
      • 1970-01-01
      • 2012-01-27
      相关资源
      最近更新 更多