Remove overlay with position
I want to remove same overlay at the specific position. This is my code for add the overlay, but how can get the position for every overlay?
public void visual_overlay(List<DatiOverlay> list_overlay){
CustomOverlay itemized_overlays = null;
GeoPo开发者_如何转开发int point = null;
for(int ov=0;ov<list_overlay.size();ov++){
itemized_overlays = new CustomOverlay(drawable,mappa, Integer.toString(list_overlay.get(ov).get_id_segnalazione()),list_overlay.get(ov).get_via(),list_overlay.get(ov).get_citta(),list_overlay.get(ov).get_descrizione(),list_overlay.get(ov).get_cek_feed());
point = new GeoPoint((int)(list_overlay.get(ov).get_lat() * 1E6), (int)(list_overlay.get(ov).get_lng() * 1E6));
OverlayItem overlayItem = new OverlayItem(point, list_overlay.get(ov).get_nome(), list_overlay.get(ov).get_prezzo());
itemized_overlays.addOverlay(overlayItem);
mappa.invalidate();
mappa.getOverlays().add(itemized_overlays);
}
You remove an overlay from a MapView like this:
List<Overlay> mapOverlays = mapView.getOverlays();
if (mapOverlay != null) mapOverlays.remove(someOverlay);
精彩评论