You are not logged in.

#1 2012-06-22 16:33:21

kniren
Member
Registered: 2011-10-12
Posts: 40

Android multi-touch example using Processing

Hi there,

I've been struggling to make Android multi touch support work using the Processing library.

I know there are tons of examples around the web, but I found them to be pretty confusing to
understand. So after a lot of research, I understood how to track and process each finger
touch. This is NOT a gesture recognicion demonstration, but is intended to serve as a template
for future proyects.

I think the code is well commented and can be easily understandable by people with some java
background, nevertheless, you can ask me any questions about it.

In a nutshell:
- In the switch/case we got some MotionEvent.ACTION_* that pass the event data to a Hash List,
  if an event with certain ID is already running, it updates its X & Y values if moved, delete from
  the list if released or added if pressed.
- We print the current info of each point tracked in the HashList under each finger and how many
  of them exists.

I've tested this on my Galaxy Note and can get up to 10 track points, but note that different
devices may have different limits.

The program has been coded in Eclipse and it should work out of the box if you import it and
hit Run (If your device is correctly set up to work with debug mode through usb).

Here is the GitHub repository: https://github.com/kniren/AndroidMT

I hope this can be useful to someone.

Cheers!


Archlinux :: Xmonad
dotfiles | deviantart

Offline

Board footer

Powered by FluxBB