Clear markers from Google Map in Android

2019-01-22 10:10发布

问题:

I have added map on fragment activity and added several marker using addMarker function, but i am able to remove all markers , I am getting notification for different list of markers,

Now i wants to remove all markers and add new one.

one way to keep all markers in list and remove one by one, (marker.remove())

Is there any better way to clear all marker.

回答1:

If you want to clear "all markers, overlays, and polylines from the map", use clear() on your GoogleMap.