K
K
Kruger2018-08-13 12:10:49
Android
Kruger, 2018-08-13 12:10:49

How to catch onTouchEvent(Kotlin) during another one?

The user touches the screen, when they release their finger, the animation starts running in a loop inside MotionEvent.ACTION_UP . How to make it so that when you touch the screen again, the animation is interrupted? They write that the touches work in the MainThread and until the cycle ends, I will not be able to catch new clicks. So how do you get out of the situation?
PS everything happens inside a custom SurfaceView

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Chvarkov, 2018-08-13
@KrUgerD

move the animation to a separate thread. For example, through AsyncTask. And keep a link to it. And when catching a touch - cancel by link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question