Answer the question
In order to leave comments, you need to log in
How to make LongPress inside onTouchEvent(Kotlin)?
There is a conditional code.
Answer the question
In order to leave comments, you need to log in
The variant I use. In ACTION_DOWN, you need to remember the touch time, and in ACTION_UP, check how much time has passed. Conditionally <1500 ms - tap, more - long tap. If exactly after N time it is necessary to notify about a long tap, even if the user has not removed his finger, then I start the timer for this time. But then in ACTION_OUTSIDE / ACTION_POINTER_UP / ACTION_CANCEL you need to reset the timer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question