我刚刚让我的地图在我的应用程序中工作。我有问题。当这个地方出现在地图上时。我希望能够单击该地点并将其显示在适当的 Google 地图应用程序中。因此,如果需要,您可以导航到该地点。
所以我有一张地图,上面有一个标记。我想点击标记,然后在谷歌地图中找到地址。这样一来,如果人们要导航,他们只需点击它,然后获取路线。
java代码如下:
public class showroommap extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(52.633011,-1.132913);
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.showroommap);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
.title("Hamburg"));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("Kiel")
.snippet("Kiel is cool")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
//Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
//Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
这可能吗?
更多信息:我想点击我的应用程序中显示的标记。单击标记后,它将转到谷歌地图并根据需要定向到它。