I am currently using the ItemizedOverlay class from the Maps V1 API, which keeps track of what marker (if any) is currently selected. Is there any similar functionality in Maps V2 to determine which marker is currently selected? Also, is there a way to programatically select a new marker?
I am currently using the ItemizedOverlay class from the Maps V1 API, which keeps
Share
Yes.
To determine which marker is selected, add a OnInfoWindowClickedListener to your GoogleMap:
Override the onInfoWindowClicked() method inside of the OnInfoWindowClickListener:
And keep track of the selected marker, perhaps with an instance variable.
To select a marker programmatically, you’ll have to keep a list of all your markers, then get a handle on one and call showInfoWindow(), similar to this: