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 ad开发者_Go百科ditional 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?
onTouchEvent covers any kind of touch event, that include onTap, onScroll, on Fling, etc
An onTap
event is generally a quick down and up motion that is pretty the same as onClick
. An onTouch
event covers all types of touch events which can be separated with ACTION_DOWN
, ACTION_UP
, ACTION_MOVE
, etc.
精彩评论