Arch1tect
Arch1tect

Reputation: 4281

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
        }

});

Upvotes: 6

Views: 3253

Answers (1)

user1959417
user1959417

Reputation: 224

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.

Upvotes: 9

Related Questions