It appears that the hitTest method is not working right when I iterate
through the items in my ItemizedOverlay and call hittest on them in
the onTap(GeoPoint, MapView) method.
I am doing this because I want to handle taps both when they are on an
item and not (where I create a new item). If I override both onTap
methods the onTap(int) never gets called...
Anyway, the problem I have with hitTest is that it only returns a hit
if you tap the upper left corner of the display (where there is no
item).
I wrote the following in the onTap method
for (OverlayItem item : items) {
android.graphics.Point itemPoint =
mapView.getProjection().toPixels(item.getPoint(), null);
android.graphics.Rect bounds = item.getMarker(0).getBounds();
bounds.offset(itemPoint.x, itemPoint.y);
if (bounds.contains(screenPoint.x, screenPoint.y)) {
.<handle item tapped>
.return true;
}
} // for
I suspect that the hitTest method is not offsetting the marker to the
location of the item...
Since the arguments of the hitTest don't take the MapView or
Projection, I don';t see how it can work right...
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en