remove an overlay in map
I am showing current location using a red marker and some other 开发者_运维技巧set of location using a blue marker. After an operation, I have to remove some of the locations indicated using blue marker. Rest should be shown in the map itself. How will I do it?
You can use mapOverlays.remove(1) 1 is the position of overlay or you can use object where you can remove overlays.
Since mapOverlays.remove()
cannot be kept in my code due to some other reasons, I cleared the complete set of overlays using mapOverlays.clear()
and added those overlays wish I require.
You should use yourMapOverlays.remove(the_index_of_Obstacle); . For this reason you should keep track of the object you specifically need to update later or remove. like adding itat last and access it using yourMapOverlays.size()-1
精彩评论