How to perform map marker click in HERE MAP (android )

前端 未结 3 1623
后悔当初
后悔当初 2021-01-21 09:14

I am using a map. I found an issue. How do i know which marker is clicked?

@Override
public boolean onMapObjectsSelected(List         


        
3条回答
  •  生来不讨喜
    2021-01-21 09:34

      MapGesture.OnGestureListener onGestureListenernew= new 
      MapGesture.OnGestureListener() {
        @Override
        public void onPanStart() {
    
        }
    
        @Override
        public void onPanEnd() {
    
        }
    
        @Override
        public void onMultiFingerManipulationStart() {
    
        }
    
        @Override
        public void onMultiFingerManipulationEnd() {
    
        }
    
        @Override
        public boolean onMapObjectsSelected(List list) {
    
            for (ViewObject viewObject : list) {
                if (viewObject.getBaseType() == ViewObject.Type.USER_OBJECT) {
                    MapObject mapObject = (MapObject) viewObject;
    
                    if (mapObject.getType() == MapObject.Type.MARKER) {
    
                        MapMarker window_marker = ((MapMarker)mapObject);
                         Log.d("danish","danish");
                        System.out.println("Title is................."+window_marker.getInfoBubbleHashCode());
                        Toast.makeText(m_activity,"Hello"+window_marker.getCoordinate(),Toast.LENGTH_LONG).show();
                        return false;
                    }
                }
            }
            return false;
        }
    
        @Override
        public boolean onTapEvent(PointF pointF) {
    
            return false;
        }
    
        @Override
        public boolean onDoubleTapEvent(PointF pointF) {
            return false;
        }
    
        @Override
        public void onPinchLocked() {
    
        }
    
        @Override
        public boolean onPinchZoomEvent(float v, PointF pointF) {
            return false;
        }
    
        @Override
        public void onRotateLocked() {
    
        }
    
        @Override
        public boolean onRotateEvent(float v) {
            return false;
        }
    
        @Override
        public boolean onTiltEvent(float v) {
            return false;
        }
    
        @Override
        public boolean onLongPressEvent(PointF pointF) {
            return false;
        }
    
        @Override
        public void onLongPressRelease() {
    
        }
    
        @Override
        public boolean onTwoFingerTapEvent(PointF pointF) {
            return false;
        }
    };
    

    then add

    m_mapFragment.getMapGesture().addOnGestureListener(onGestureListenernew);
    

提交回复
热议问题