Identifying the GeoPoint that trigger an onTap call

Posted by Akroy on Stack Overflow See other posts from Stack Overflow or by Akroy
Published on 2012-11-28T17:01:47Z Indexed on 2012/11/28 17:04 UTC
Read the original article Hit count: 205

I'm developing a Google Maps app on Android. I have a number of GeoPoints that I'm displaying by adding them as OverlayItems to an ItemizedOverlay. This works well for displaying them and bringing up a nice box when I click them, however I'm trying to put info in the box it brings up.

Thus, I've extended ItemizedOverlay with my own class, and I'm overriding onTap (final GeoPoint p, final MapView mapView). At first I thought that this would be very simple, as one of the parameters is the GeoPoint, so I would know exactly which GeoPoint was clicked. However, from what I can tell, the GeoPoint argument there is the GeoPoint for where the user actually touched. Given the range the user can touch and still trigger the onTap, that GeoPoint isn't very helpful for knowing precisely which GeoPoint was actually touched.

I'm currently checking the parameter GeoPoint against all my existing GeoPoints and seeing which it's closest to. This seems like a super hacky abstraction inversion. Is there a better way to know what was actually tapped?

© Stack Overflow or respective owner

Related posts about java

Related posts about android