InfoWindow (Google Maps) catching a window close event

What are the ways to launch an action when closing an infoindust? I can not find listeners. I was thinking of starting some background Runnable check if marker.isInfoWindowShown ().

What I want to do is display a button above my map when the user clicks a point (an information line appears), this button is also located at the bottom of the screen. When the Windows information disappears, the button is also no longer visible.

Any tips that listeners should I read?

+6
source share
2 answers

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.

+12
source

Well, I'm too late to answer that, but now you can find out if the google map closes using the following method.

@Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; mMap.setOnInfoWindowCloseListener(new GoogleMap.OnInfoWindowCloseListener() { @Override public void onInfoWindowClose(Marker marker) { //hide or do something you want } }); } 
+4
source

Source: https://habr.com/ru/post/953663/


All Articles