Google Maps V2 - Android - Get a list of Markers

后端 未结 2 1144
别跟我提以往
别跟我提以往 2020-12-05 23:30

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 mapV         


        
相关标签:
2条回答
  • 2020-12-06 00:01

    Alternative to the correct answer from CommonsWare would be using Android Maps Extensions, which adds getMarkers() function to GoogleMap.

    Btw. mapView.getOverlays().add(overlay) code from Maps V1 is a very bad design choice. You should not give out List for modification. So this will not work with Extensions library.

    0 讨论(0)
  • 2020-12-06 00:13

    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>).

    0 讨论(0)
提交回复
热议问题