I have two overlays, one is (ItemizedOverlay) for placing markers on the map and other is (Overlay) for drawing route from source to destination. It’s fine in drawing route on map with respect to the changes of markers on the map. But problem is the previously drawn route cannot be erased to draw new route.
I tried mapView.getOverlays().clear(). But it is erasing both markers and route.
Is there any possibility get one overlay object among two defined overlays for mapview?
mapView.getOverlays()returns a list ofOverlays that is being used. You can remove oneOverlayfrom that list, leaving the other.Or, if you know the index of your
Overlayin the list: