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

前端 未结 3 1625
后悔当初
后悔当初 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:27

    To obtain which marker is clicked do like below in onMapObjectsSelected method.

    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);
    
               System.out.println("Title is................."+window_marker.getTitle());
    
                  return false;
                }
            }
       }
    

    You have to find out which object type is selected in loop as above.

提交回复
热议问题