Search code examples
androidonclicktouchgesture

Difference between onSingleTapConfirmed and onSingleTapUp


What is the difference between onSingleTapConfirmed and onSingleTapUp in GestureDetector.SimpleOnGestureListener? Which one of these is similar to onClick methods?


Solution

  • According to the GestureDetector.SimpleOnGestureListener documentation,

    onSingleTapConfirmed

    Notified when a single-tap occurs.

    Unlike onSingleTapUp(MotionEvent), this will only be called after the detector is confident that the user's first tap is not followed by a second tap leading to a double-tap gesture.

    onSingleTapUp

    Notified when a tap occurs with the up MotionEvent that triggered it.

    I think the onClick method is similar to onSingleTapConfirmed.