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 开发者_StackOverflow社区marker is being tapped so that the related data of the item will be displayed in the screen. How can I do that?
Thanks!!!
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.
精彩评论