Search code examples
androidosmdroid

How to disable the default closing behaviour from infoWindow in OsmBonusPack?


By default the OsmBonusPack infoWindow bubble closes when I tab the bubble.

How can I disable the default closing behaviour?


Solution

  • Create your own InfoWindow:

    MarkerInfoWindow myInfoWindow = new MarkerInfoWindow(layoutResId, map);
    

    Set to its view the TouchListener you want. For instance, to do nothing:

    View v = myInfoWindow.getView();
    v.setOnTouchListener(new View.OnTouchListener() {
        @Override public boolean onTouch(View v, MotionEvent e) {
            return false;
        }
    });
    

    Then give this infoWindow to all your markers:

    myMarker.setInfoWindow(myInfoWindow);