tags:

views:

122

answers:

1

Hi, 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!!!

+2  A: 

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.

CommonsWare
Thanks! :D I didn't know that I can get the index!!
Mak Sing