My question is simple, where's the onUp event when implementing a GestureListener?
I has a lot of events on the gesturedetector, and cannot just consume the onUp event of the listener, cause one of events are the onSingleTapConfirmed that needs it.
My question is simple, where's the onUp event when implementing a GestureListener?
I has a lot of events on the gesturedetector, and cannot just consume the onUp event of the listener, cause one of events are the onSingleTapConfirmed that needs it.
Try using
onFling()
. Seems like a weird name but for me, it works as theonUp()
method would logically work. Or try this method...Have you returned true from the other events you consume in your GestureDetector.OnGestureListener? I had this problem and it turns out if you return false, the system assumes you aren't interested and stops passing you events, so you miss the up!
I fixed it by reading the
Action event
before I pass it to theGestureListener
The other answers can solve the question,maybe they work good,but I don't think those are good solutions.
Because we should deal with the event in a single moudle,so that we can be esaier to maintain or expand the code.
(By the way, don not use
onFilng()
,if your finger move slowly on the screen,onFilng()
wouldn't work)So,my solution is rewriting the GestureDetector:
And the listener:
: )