You can use OSMBonusPack MapEventsOverlay and MapEventsReceiver.
How to implement clickListener at Osmdroid?
-
21-06-2023 - |
Frage
I like to implement similar method of Google Map's onMapClick(LatLng arg)
at Osmdroid. What I did was
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
But dispatchTouchEvent
is called multiple times when the map is clicked only one time. How can I implement similar method of Google Map at Osmdroid?
Thanks
Lösung
Andere Tipps
MKer's response is correct. But I like to update another solution. We can set limit using
if(ev.getAction() == MotionEvent.ACTION_DOWN)
{
}
so that there is only single call on dispatchTouchEvent{}.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow