I'm creating an Android Application where i need to set markers on the map. And since my App requires Offline function i need to use Osmdroid to solve this problem. Now my issue is the markers on the map, which i can easily add them by using Markers or the ItemizedOverlay, but the issue i'm having is that i cannot remove markers from the map.
The code i have used for adding markers is this one:
Marker marker = new Marker(mapView);
marker.setPosition(new GeoPoint(41.3746312,19.7710733));
marker.setIcon(getResources().getDrawable(R.drawable.marker));
marker.setImage(getResources().getDrawable(R.drawable.marker));
marker.setTitle("Marker");
marker.setInfoWindow(null);
marker.showInfoWindow();
mapView.getOverlays().add(marker);
mapView.invalidate();
but i'm encountering issues on removing them since the only way to remove it is:
mapView.getOverlays().clear();
And i need to remove a specific marker instead of all of them at the same time.