infowindowosmdroidosmbonuspack

Display multiple InfoWindows using osmdroid


I want to display multiple marker infoWindows to mark different routes. However, only the last created one is being displayed.

My (relevant) marker creation code is:-

    if (routes.size() < 3) {
        Polyline roadOverlay = new Polyline();
        roadOverlay.setColor(polyClr.get(routes.size()));
        roadOverlay.setWidth(5f);
        roadOverlay.setPoints(waypoints);

        //  Add Route Marker

        Marker m = new Marker(map);
        double d = roadOverlay.getDistance()*5/8000;
        GeoPoint midpt = waypoints.get((int)(waypoints.size()/2));
        m.setTitle(rteDesc.get(routes.size())+" - "+String.format("%.2f miles",d));
        m.setSnippet("Tap to Save");
        m.setIcon(getResources().getDrawable(R.drawable.transparent));
        m.setPosition(midpt);
        m.showInfoWindow();
        rtemkrs.add(m);

        routes.add(roadOverlay);
    }

and the display code is:-

    for (int j = rtemkrs.size()-1; j>=0; j--) {
        map.getOverlays().add(rtemkrs.get(j));
    }
    map.invalidate();

I'm using osmdroid v 6.1.0 and osmbonuspack v 6.6.0

How can I display multiple marker infoWindows?


Solution

  • By default, all markers use one shared view as their InfoWindow. Therefore only the one view can be displayed.

    But it is possible to change the behaviour: