For anyone else who runs into this (if they do) I figured out the
problem.  My custom ItemizedOverlay onTap method was calling the super
class onTap to return the boolean.  This is incorrect because the
ItemizedOverlay onTap by default always returns false meaning that
overlay did not handle the onTap and it should cycle through to the
next overlay.  Subclasses should override this to return true if the
onTap was handled.  This explained why it was popping a Toast for each
of the 4 overlay instances.

//Incorrect overridden onTap:
       protected boolean onTap(int index) {
                //Do stuff
                return super.onTap(index);
        }

//Correct overridden onTap:
      protected boolean onTap(int index) {
                //Do stuff
                return true;
        }


On Jun 4, 11:03 pm, Derek <[email protected]> wrote:
> Searched around and haven't seen anyone complaining about this so I
> guess I'll toss it out.  Our app uses a MapView and we create 4
> instances of a custom ItemizedOverlay object and add all to the
> MapView overlays.
>
> Our app creates events and based on the event type, adds it to the
> appropriate instance of the custom ItemizedOverlay.  Everything
> displays fine, they each have a different marker so its easy to see
> one set versus another.  The custom ItemizedOverlay has an overridden
> onTap(int index) to show a Toast with some info about the item.
>
> The problem occurs once there are events in 2 or more of the custom
> ItemizedOverlay instances.  Tapping one of the markers causes the
> other ItemizedOverlays to respond to onTap as well, regardless of
> whether they are close on the map or not.
>
> Has anyone seen anything like this?  Found a way around it?  I'm
> wondering if the problem is the fact that all 4 instances are of the
> same type but it still seems strange behavior.  Thoughts anyone?
>
> Thanks,
> Derek
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to