Question

I'd like to add an unfocus listener on the markers of my map, but it doesn't seem to exists. What would be the best way to do that?

I do understand that there is no unfocus listener function, sorry for the unclear explanation. When I click on a marker I show a linearLayout on the bottom of the screen and modify a textview. What I want to do is hide this linearLayout when the user clicks somewhere else on the map.

I don't want to use InfoWindow.

Was it helpful?

Solution 2

You may achieve that by:

  • remembering currently focused Marker in onMarkerClick or getInfoWindow
  • clearing currently focused Marker in onMapClick and also after other events like setVisible or remove called on focused Marker (if you use them in your code)

OTHER TIPS

There is no UNFOCUS in markers because there is no need. When you click anywhere else on the map it will automatically be unfocused.
EDIT :
You can use onMapClickListner to get the click on the map. This way the marker will automatically unfocused and you can handled that event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top