A basic multi-touch gesture demo for Android
in
Android Processing
•
2 years ago
I needed some basic gestures for a project and I found the GestureDetector class from the SDK to be unreliable. Also, it only detects pinches. There are probably better solutions out there but I just wanted something with no frills and not a big modular framework.
This code will:
- keep a list of active points for you (like what ak_eric has posted)
- trigger events on: pinch, rotate, drag, tap, double-tap and flick. For pinch, rotate and drag you get the number of fingers involved too, so for instance you could program different behaviors for a 2 finger pinch vs 4-finger pinch.
Here's the code in case anyone is interested. I have tested it on the Galaxy Tab and the GTablet. I'd like to make a proper library out of it in a week or so when my project is done. In the meantime, comments or suggestions are welcome!
This could also work easily with other multi-touch input sources.
http://www.deadpixel.ca/MultiTouch.zip
This code will:
- keep a list of active points for you (like what ak_eric has posted)
- trigger events on: pinch, rotate, drag, tap, double-tap and flick. For pinch, rotate and drag you get the number of fingers involved too, so for instance you could program different behaviors for a 2 finger pinch vs 4-finger pinch.
Here's the code in case anyone is interested. I have tested it on the Galaxy Tab and the GTablet. I'd like to make a proper library out of it in a week or so when my project is done. In the meantime, comments or suggestions are welcome!
This could also work easily with other multi-touch input sources.
http://www.deadpixel.ca/MultiTouch.zip
5