Android :: Keyboard Input - Touch Event NoisyJul 21, 2010
I'm working on a simple game: when you press a button on the screen, a character will run to certain direction. It's easy to support keyboard input. But, some phone doesn't go with a keyboard or even no a track ball. So I decided to draw a virtual "run" key on the screen (with opengl). When the user press the virtual key, I apply a velocity to the character. And when the user release the key, I disable the velocity to stop the character but there seems to be some touch event noisy. If my finger cannot press still, I will see millions of touch down and touch up events, instead of a single long pressing.
And occasionally, my program captured the touch down event when I touch the screen, but didn't capture touch up event. So my character will keep moving, even no finger is on the screen. I'm wondering if there is some way to reduce the touch event noisy and tell if the user is currently pressing on the screen, instead of only getting an event when touch up and down happen. It seems the system UI can detect long pressing, for example when you put a finger on one item of the list view widget, the entire item turns to orange. I just don't know how to detect pressing in my opengl game.