I have
MapView map = new MapView(this, MapRenderMode.VECTOR);
MapIcon pushpin = new MapIcon();
MapElementLayer mPinLayer = new MapElementLayer();
mPinLayer.getElements().add(pushpin);
map.getLayers().add(mPinLayer);
and I need to execute this:
Microsoft.Maps.Events.addHandler(pushpin, 'click', function () {});
but in Android Java, not JS
Found workaround.
mMapView.addOnMapTappedListener(new OnMapTappedListener() {
@Override
public boolean onMapTapped(MapTappedEventArgs mapTappedEventArgs) {
Point position = mapTappedEventArgs.position;
LinkedList<MapElement> elements = mMapView.findMapElementsAtOffset(position);
for (MapElement mapElement: elements)
{
if (mapElement instanceof MapIcon) {
MapIcon mapIcon = (MapIcon) mapElement;
// Do your thing. For example set fly out visibility.
// mapIcon.setIsFlyoutVisible(!mapIcon.getIsFlyoutVisible());
}
}
return false;
}
});