Android google maps API - unfocus marker listener

1.5k views Asked by At

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.

2

There are 2 answers

0
MaciejGórski On BEST ANSWER

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)
0
johntheripp3r On

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.