Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 641
Marcus Johansson Avatar asked Oct 18 '25 14:10

Marcus Johansson


1 Answers

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.

like image 92
Frank Avatar answered Oct 21 '25 04:10

Frank