I\'m adding default Marker to GoogleMap the following way:
GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.editMapMap)).getMap();
There are two methods for showing and hiding the markers. The boolean return value simply prevents the default behaviour from taking place (false) or allows it to happen (true). In other words, it informs the system whether you consumed the event or not. See Google API Reference.
private GoogleMap.OnMarkerClickListener onMarkerClickedListener = new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.isInfoWindowShown()) {
marker.hideInfoWindow();
} else {
marker.showInfoWindow();
}
return true;
}
};
mGoogleMap.setOnMarkerClickListener(onMarkerClickedListener);