I have implemented my own custom MapListener
for Polygons
and for Markers
in Nutiteq
and I can show Toasts
and change colors of elementsand other things but the listener doesn't react if I click long over a Marker or over a Polygon.
I have already tried with RegisterContextMenu, ContextMenuListener, etc outside my customListener and it was the same, it doesn't work.
My Intention is showing a ContextMenu
if I click long over an element(Marker/Polygon).
The code is the following
I have properly overriden the Methods
public class MyFieldEventListener extends MapListener {
private GeometryLayer layer;
private Marker clickMarker;
private MapView mapView;
private Activity activity;
public MyFieldEventListener(Activity activity, MapView mapView, GeometryLayer layer, Marker clickMarker) {
this.layer = layer;
this.clickMarker = clickMarker;
this.mapView = mapView;
this.activity = activity;
// I have also tried with this line commented and it's the same
mapView.setLongClickable(true);
// here I register my ContextMenu
activity.registerForContextMenu(mapView);
// Here I define my ContextMenuListener and create a ContextMenu
mapView.setOnCreateContextMenuListener( new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
Log.i("TAG", "WmsMapActivity:: setOnCreateContextMenuListener.onCreateContextMenu");
menu.setHeaderTitle("Notes");
menu.add(0, 1, 0, "Write Text Note");
}
} );
}
@Override
public void onLabelClicked(VectorElement vectorElement, boolean longClick) {
if (vectorElement.getLabel() != null) {
if ( longClick )
mapView.showContextMenu();
else { // Another Stuff... }
}
@Override
public void onVectorElementClicked(VectorElement vectorElement, double x, double y, boolean longClick) {
if (vectorElement.getLabel() != null) {
if (longclick)
mapView.showContextMenu();
else { // Another Stuff... }
}
}
...
}
I would thank you for each Remark, Advise, etc
Kind Regards