Google Maps V2 - Android - Get a list of Markers

user268397 picture user268397 · May 3, 2013 · Viewed 32.4k times · Source

I'm trying to get a list Markers(using GMaps V2 for Android) similar to the getOverlays() method I used in GMaps V1.1 for Android here:

private MapView mapView; 

mapView.getOverlays().add(overlay);

How can I do something similar to what I did above but with Markers?

Any help would be appreciated.

Answer

CommonsWare picture CommonsWare · May 3, 2013

How can I do something similar to what I did above but with Markers?

When you call addMarker(), save the resulting Marker object in a collection of your choice (e.g., ArrayList<Marker>).