-1

I am looking to add multiple onCLickListener on the Customize BalloonPopup to handle different behaviour.

https://developer.nutiteq.com/guides/events

public class MyMapEventListener extends MapEventListener {
    private MapView mapView;
    private LocalVectorDataSource vectorDataSource;

    private BalloonPopup oldClickLabel;

    public MyMapEventListener(MapView mapView, LocalVectorDataSource vectorDataSource) {
        this.mapView = mapView;
        this.vectorDataSource = vectorDataSource;
    }



    @Override
    public void onMapClicked(MapClickInfo mapClickInfo) {
        Log.d(Const.LOG_TAG, "Map click!");

        // Remove old click label
        if (oldClickLabel != null) {
            vectorDataSource.remove(oldClickLabel);
            oldClickLabel = null;
        }

        BalloonPopupStyleBuilder balloonPopupStyleBuilder = new BalloonPopupStyleBuilder();
    balloonPopupStyleBuilder.setCornerRadius(20);
    balloonPopupStyleBuilder.setLeftMargins(new BalloonPopupMargins(6, 6, 6, 6));
    balloonPopupStyleBuilder.setLeftImage(BitmapUtils.createBitmapFromAndroidBitmap(infoImage));
    balloonPopupStyleBuilder.setRightImage(BitmapUtils.createBitmapFromAndroidBitmap(arrowImage));
    balloonPopupStyleBuilder.setRightMargins(new BalloonPopupMargins(2, 6, 12, 6));
    balloonPopupStyleBuilder.setPlacementPriority(1);
    BalloonPopup popup1 = new BalloonPopup(proj.fromWgs84(new MapPos(24.655662, 59.425521)),
                                           balloonPopupStyleBuilder.buildStyle(),
                                           "Popup with pos",
                                           "Images, round");
    popup1.setMetaDataElement("ClickText", "popupcaption nr 1");
    vectorDataSource1.add(popup1);

        // Check the type of the click
        String clickMsg = null;
        if (mapClickInfo.getClickType() == ClickType.CLICK_TYPE_SINGLE) {
            clickMsg = "Single map click!";
        } else if (mapClickInfo.getClickType() == ClickType.CLICK_TYPE_LONG) {
            clickMsg = "Long map click!";
        } else if (mapClickInfo.getClickType() == ClickType.CLICK_TYPE_DOUBLE) {
            clickMsg = "Double map click!";
        } else if (mapClickInfo.getClickType() == ClickType.CLICK_TYPE_DUAL) {
            clickMsg ="Dual map click!";
        }


    }
}

Is there a way to achieve this?

Fahim
  • 12,198
  • 5
  • 39
  • 57

2 Answers2

0

Have you tried implementing GestureDetector.SimpleOnGestureListener class?

denis_lor
  • 6,212
  • 4
  • 31
  • 55
0

I'm afraid with current Nutiteq SDK API you can not have several listeners or buttons on one BalloonPopup. Workaround would be to use separate Android View instead of Popup on map, like e.g. Google Maps app latest versions do: they do not try to show complex data, and buttons as map popup at all, but use separate screen area for this.

JaakL
  • 4,107
  • 5
  • 24
  • 37