Search code examples
androidgoogle-mapsgoogle-maps-markersmarkers

Android : Count markers in the map


How to know how many markers I have on my map ?
On iOS it's simple : myMap.annotations.count.

How to do this on Android ? thanks


Solution

  • There's no way to do this with the stock Maps. There are two options:

    1. Keep track of the marker count yourself as they are added in and simply use that count when it is required; or

    2. Introduce a dependency to Android Maps Extensions, which adds a getMarkers() function to the Map object.