Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MyLocationOverlay dispatchTap() doesn't propagate

I have a MapView with some overlays and a subclass of MyLocationOverlay on top of them because I want the user current location to show above the other markers.

I'm handling the onTap event for the markers to show a panel with info of the tapped marker and if tapped outside of a marker (even in the location marker) the panel should hide.

If I click on a marker or in an empty spot everything is fine, the panel shows or hides as expected, but if I click on the location marker nothing happens (if the location marker is over another marker the info doesn't show and if it's outside and the info is showing it doesn't hide).

In my MyLocationOverlay I overrided dispatchTap() function making it return false as stated in docs:

Returns: True if this tap was processed; false if it should be sent to the other overlays.

but still doesn't work, even I tried returning true just in case, but nothing...

Anybody knows how to propagate the onTap event to the other overlays?

like image 726
maid450 Avatar asked Feb 06 '11 12:02

maid450


1 Answers

"Fixed since android 2.0, it was a known issue of some phones"

From - Propagate events in several layers android google maps

"If you are seeing the overlay items you put on your MapView, your onTap() will be triggered when you tap on any of the overlay items. onTap(GeoPoint point, MapView view) is always triggered regardless of where the user taps. Therefore, you can override it to see if it's triggered. onTap(int i) will run after it in the case where an overlay item is clicked."

From - https://stackoverflow.com/questions/6680387/ontap-event-on-map-is-not-fired

like image 87
Graham Avatar answered Nov 14 '22 20:11

Graham