Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to do that when i click on the map, the marker disappeared?

Tags:

osmdroid

I use asmdroid 4.2 and bonuspack 4.5.

my code add marker:

       Marker startMarker = new Marker(mapView);
        startMarker.setPosition(new GeoPoint(locationA,locationB));
        startMarker.setIcon(getResources().getDrawable(drawable)); 
        startMarker.setTitle("jkdfghspdifj");
        startMarker.setAnchor(Marker.ANCHOR_CENTER, 1.0f);
        MarkerInfoWindow infoWindow = new  MyInfoWindow(R.layout.bonuspack_bubble, 
                mapView,title);
        startMarker.setInfoWindow(infoWindow);


 mapView.getOverlays().add(startMarker);

 mapView.zoomToBoundingBox(boundingBox);

 mapView.invalidate(); 

everything works fine :)

I click on the marker and displayed popup window. and how to do that when you click on the card itself, the marker disappeared? (at the moment it disappears unless again click on it)

like image 213
SKULL Avatar asked Mar 20 '23 12:03

SKULL


1 Answers

To close all open popups when tapping anywhere on the map, follow the Tutorial 5, Chapter 16. Handling Map events

To have an open popup that closes when you are opening the popup on an other marker, a simple solution is to share the same infoWindow object between all your markers.

Or call "InfoWindow.closeAllInfoWindowsOn(map);" in onOpen.

like image 139
MKer Avatar answered May 17 '23 15:05

MKer