Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 212
Binoy Babu Avatar asked Mar 02 '15 17:03

Binoy Babu


People also ask

What is the difference between onSingleTapUp and onSingleTapConfirmed callbacks?

onSingleTapConfirmed. Notified when a single-tap occurs. Unlike OnGestureListener#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.

What is onShowPress?

onShowPress The user has performed a down MotionEvent and not performed a move or up yet. This event is commonly used to provide visual feedback to the user to let them know that their action has been recognized i.e. highlight an element.


1 Answers

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.

like image 154
Fahim Avatar answered Oct 08 '22 10:10

Fahim