Android - Removing markers when changing different maps
0
I have created an app that displays different tracks in a park. I have created two markers which represent the start and end of the track. I am getting a problem where when I change tracks, the marker from the previous track still shows. I tried map.clear() but that removed everything. I want to not show the markers from the previous track. private void createMarker(double latitude, double longitude, String title) { map.addMarker(new MarkerOptions() .position(new LatLng(latitude, longitude)) .title(title) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW))); } private void updateMapTrack() { switch (options.getTrack()) { case TRACK1: createMarker(-45.85696303760779, 170.5199563062967, "Start of track1....