GlobaLevel
asked on
Android - get gestures from user on touch screen
I need to get the values of gestures that a user registers on the touch screen so if they tap one launches this method, if they tap twice launches this method ...
ASKER
thanks so much...would you have any sample code by any chance?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1) add GestureDetector.OnDoubleTa
2) early in creation of your view (constructor usually), create the gesture handler, like:
mGestures = new GestureDetector(context, this);
That makes a gesture detector object (which, obviously, needs to be a member of the view class..) that will dispatch any gestures to the view as callbacks.
3) in the view's onTouchEvent handler, let the gesture handler have first shot:
mGestures.onTouchEvent(e);
.. then do any other handling.
4) Finally, implement onDoubleTap, onSingleTapConfirmed, callbacks to differentiate/handle the two events.
Hope that helps!