Search code examples
androidosmdroid

infoWindow on MarkerClusterer in OsmBonusPack?


Is there a possiblity to open a infoWindow with a click on a MarkerClusterer with OsmDroid + OsmBonusPack?

I want to display information about the different Markers which are inside the MarkerClusterer.


Solution

  • Yes, you can.

    Sub-class the RadiusMarkerClusterer (I assume you are using this one), and override the #renderer method.

    Copy the RadiusMarkerClusterer.renderer. Then, just after the Marker is created:

    Marker m = buildClusterMarker(cluster, mapView);
    

    give to this Marker your InfoWindow:

    m.setInfoWindow(myOwnInfoWindow)
    

    You may have to sub-class the MarkerInfoWindow, depending on what you want to display exactly about the clustered markers.