I know that you have already chosen the answer, but the selected one does not do what you need.
I am also busy with an application that uses markers and has a view that switches when the user selects and deselects the marker.
This is a simple job.
mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() { @Override public void onMapClick(LatLng latLng) { mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) {
This is the use of two click listeners. Thus, you can switch the visibility depending on what the user clicks.
source share