Search code examples
androidmapstouch-event

Difference between onTap and onTouchEvent in Android


I have an application showing the map and some markers on it. I use the function draw(Canvas canvas, MapView mapView, boolean shadow, long when) to put the markers. If you click somewhere on the map a toast appears and shows the address of the location clicked. I implement this with the onTouchEvent(MotionEvent event, MapView mapView) function. But I want when you click a marker a separate dialog with additional info to show up. In some tutorials they use the onTap for this - is there any difference between the onTap and the onTouchEvent functions? And is there any other (better) function in order to make this dialog appear you would recommend me?

How to differentiate a click on the map from a click on a marker?


Solution

  • onTouchEvent covers any kind of touch event, that include onTap, onScroll, on Fling, etc