kushal kushal - 22 days ago 6
Android Question

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

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

@Override
public boolean onMapObjectsSelected(List<ViewObject> list) {..)


with On Gesture Listener i got this method but how to find particular map marker object and map marker title etc.

Answer

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.