Marcus Johansson
Marcus Johansson

Reputation: 2667

How can I sense if the user is holding down their finger on the screen without moving it?

I am currently using pure OpenGL to paint buttons in my own little way.

I can detect if a button is pushed with onTouchEvent, but I want to know if the user is holding the button down, or if the user is no longer touching the screen.

Upvotes: 4

Views: 2693

Answers (1)

Frank
Frank

Reputation: 3296

After the initial MotionEvent.ACTION_DOWN event, all of the subsequent touch events(user keeps finger on the screen) will be MotionEvent.ACTION_MOVE events until the user lifts their finger off of the screen which will register as an MotionEvent.ACTION_UP event.

If you want to make sure the user still has their finger on the button do bounds checking during MotionEvent.ACTION_MOVE events or if you don't care if the user drags their finger off of the button just check for a MotionEvent.ACTION_UP event.

Upvotes: 6

Related Questions