Reyjohn
Reyjohn

Reputation: 2714

Overlay item OnTap method is being called for every items in a map

I have this ontap method to show a toast for which Item I have tapped:

@Override
        protected boolean onTap(int index) {
            // TODO Auto-generated method stub
        String name= ballon.get(index).getTitle();


        Toast.makeText(c, name, Toast.LENGTH_LONG).show();

            return false;
        }

But when there is more than one item then its toasting for the every item on that map even if I tap on only one item. I want to show toast for only one item that i have tapped. Is there any tricks or did something I miss here?

Upvotes: 0

Views: 226

Answers (1)

Paul Nikonowicz
Paul Nikonowicz

Reputation: 3903

Have onTap return true instead of false. True signals to stop the event bubbling.

Upvotes: 1

Related Questions