【发布时间】:2014-04-25 20:32:28
【问题描述】:
我有 3 个商店位置标记,每个标记都有自己的位置(纬度和经度),我想点击一个标记,以便它打开标准 Google 地图,其方向为当前用户所在的位置单击标记的目的地,现在获取用户位置是确定的,单击标记以显示 sn-p 确定但我如何单击 sn-p 弹出窗口(“单击此处获取路线”)以打开谷歌地图标配 Android 手机导航?
杰夫:
static final LatLng ARCADIA = new LatLng(-25.746318, 28.221322999999984);
static final LatLng HATFIELD = new LatLng(-25.7487333, 28.238043199999993);
static final LatLng CENTURION = new LatLng(-25.8602778, 28.189444399999957);
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locate_store);
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
//map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
map.setMyLocationEnabled(true);
map.animateCamera( CameraUpdateFactory.zoomTo( 5.0f ) );
Marker aracdia = map.addMarker(new MarkerOptions().position(ARCADIA).title("Arcadia")
.snippet("Cnr Beatrix & Hamilton Street\n Contacts:\nTel: 076 7533 123\n click-for-directions")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small)));
Marker hatfield = map.addMarker(new MarkerOptions().position(HATFIELD).title("Hatfield").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small)));
Marker centurion = map.addMarker(new MarkerOptions().position(CENTURION).title("Centurion").icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_small)));
【问题讨论】: