Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if user "deselects" marker on google map

I'm looking for a way to detect when a marker on Google map is deselected. I have a Sliding drawer, where the handle is invisible until the user clicks on the marker, and I want to make it invisible again once the marker is "deselected". I've tried with marker.isInfoWindowShown() but I couldn't get it to work.

like image 753
Erik Soderstrom Avatar asked Sep 03 '13 08:09

Erik Soderstrom


People also ask

Can you remove markers from Google Maps?

Click the marker to reveal the editing options. Click the "Delete" link in the lower-left corner of the dialog box.

What does a green marker mean on Google Maps?

Green – Vegetation, darker shades mean more dense. Tan – Sand & scrub, lighter shades mean less vegetation. White – Void of any vegetation, sand dunes, mountain peaks. Light Gray – Population areas, cities, suburbs. Medium Gray – Military areas.

What does a blue marker mean on Google Maps?

Google Maps Blue Pins Are For Locations You Searched Near; For Example...

How do I find the marker ID on Google Maps?

getId() function to retrieve marker id.


1 Answers

There is no event for info window disappearance, but you may work it around using

map.setOnMapClickListener(new OnMapClickListener() { ... });

and a couple of other "events" that make info window disappear. If you use marker.remove() or marker.setVisible(false), they also make info window disappear when called on a marker that shows info window.

You will have to save markerShowingInfoWindow reference (probably from OnMarkerClickListener or InfoWindowAdapter).

like image 75
MaciejGórski Avatar answered Sep 24 '22 00:09

MaciejGórski