Reputation: 77984
I want to clear all map overlays or markers from google map and using following code
if(!mapOverlays.isEmpty())
{
mapOverlays.clear();
}
which is giving me exception can any one guide me? am i right or wrong if i am wrong then kindly provide me the solution to my problem.
i want map clean if there is any marker on it.
any help would be appriciated.
Upvotes: 3
Views: 14869
Reputation: 942
If you need to entirely clear map overlays you'd need to clear ListArray in class that extends ItemizedOverlay.
Something like this:
mItemizedOverlay.clearOverlays();
mMapView.getOverlays().clear();
mMapView.invalidate();
Upvotes: 1
Reputation: 77984
mapView.invalidate();
i was missing to update map. now working fine. so the whole code look like
if(!mapOverlays.isEmpty())
{
mapOverlays.clear();
mapView.invalidate();
}
Upvotes: 17