Android Detect Touching
I am working on a simple game. While user is touching the screen, increment some variable. While not, do nothing. I am Using surfaceView onTouchEvent, but it doesn't work because i
Solution 1:
Read about the MotionEvents that are passed to the onTouchEvent method. Specifically, look at ACTION_DOWN
and ACTION_UP
. You should receive motion events when a pointer touches the screen and when it leaves the screen.
Beyond that, the fun part is figuring out how to record progress between the ACTION_DOWN
and ACTION_UP
events (=
If you need a hint, you might start by looking at:
Solution 2:
In your XML layout file, you should set longClickable property of SurfaceView to true
android:longClickable="true"
Post a Comment for "Android Detect Touching"