Mak Sing
Mak Sing

Reputation: 891

How to know which overlayitem is being tapped?

currently I used a map view and placed some overlay items in them

I overiden the onTap function in ItemizedOverlay so that when user tap on the markers icons on the map, some action will perform.

However, I don't know how to know which marker is being tapped so that the related data of the item will be displayed in the screen. How can I do that?

Thanks!!!

Upvotes: 0

Views: 467

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007474

The onTap() method receives the index of the item being tapped. Since you are the one who gave the ItemizedOverlay the items in a sequence in the first place, your code should be able to determine which item appears at that index, such as via get() on an ArrayList of OverlayItems.

This sample project demonstrates the technique.

Upvotes: 3

Related Questions