There is currently no direct listener on google maps android api corresponding to closing the pointer. But you can achieve the required functionality in your application by checking the following events, which will act as reasons for closing the info window:
1, GoogleMap.OnMapClickListener : when the user clicks on the map, any current visible warning is closed. Thus, you can add logic to this listener to perform the functions required when closing the infoindust
2, marker.hideInfoWindow () : Another reason that closing the infowindow will be closed is because of the hideinfowindow method on the marker. If you call this method, then you must add the functionality needed to close the closed window immediately after calling this method.
source share