Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't close infoWindow on map clicked. (Google Map Android API V2)

By default marker's infoWindow is closed when map is clicked. Does anyone know how I can disable this behavior? I tried to override onMapClicked but it doesn't work...

mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {

        @Override
        public void onMapClick(LatLng arg0) {

        //do nothing
        }

});
like image 618
Arch1tect Avatar asked Jun 17 '13 19:06

Arch1tect


1 Answers

One way to do it would be to keep a class variable that specifies the marker currently selected. You would set it in the onMarkerClick() method. Call it, say, currentMarker. Putting

currentMarker.showInfoWindow();

in the onMapClick() method should then do the trick.

like image 116
user1959417 Avatar answered Nov 27 '22 19:11

user1959417