// HUE is a float value ranged between 0 and 360
BitmapDescriptor defaultMarker = BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE);
// Alternatively you could create if with any bitmap desired
mMap.addMarker(
new MarkerOptions()
.position(data.getLatLong())
.draggable(false)
.visible(true)
.icon(defaultMarker)
.title("Some title"));)
.snippet(data.getMarkerDescription())
mMap is a GoogleMap instance. You can get it through the getMap() method of the MapFragment. You retrieve the MapFragment as follows:
1) If you have a the map fragment inside an activity:
((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
2) If you have a map fragment inside a fragment:
((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map)).getMap();
No hay comentarios:
Publicar un comentario