Muzzik
Muzzik

Reputation: 105

How to close infoWindow when i touch map android Osm

I do not know how i can close the InfoWindow in OSMDroid when i click anywhere on the map . I tried to check setMapListener but this way is bad and did not work. Have any idea?

Upvotes: 7

Views: 2591

Answers (1)

Lucas B.
Lucas B.

Reputation: 509

MapEventsOverlay mapEventsOverlay = new MapEventsOverlay(this, this);
map.getOverlays().add(0, mapEventsOverlay);

@Override public boolean singleTapConfirmedHelper(GeoPoint p) {
    InfoWindow.closeAllInfoWindowsOn(map);
    return true;
}

@Override public boolean longPressHelper(GeoPoint p) {
    //DO NOTHING FOR NOW:
    return false;
}

Tutorial: https://github.com/MKergall/osmbonuspack/wiki/Tutorial_5

Upvotes: 15

Related Questions