Android Multitouch Tutorial

Having wrestled with the somewhat cryptic documentation for incorporating multitouch in Android applications, I’ve finally managed to get my head around it enough to post a basic tutorial. A possible starting place is to read Making Sense of Multitouch on the Android developer blog. Also worthwhile looking at is a detailed log of mouse events. This tutorial is aimed primarily at those already familiar with the basic workings of the Android SDK.

The first thing I would suggest doing is creating a simple class to track mouse movements for a particular touch:

public class TouchStream {
	private int x, y, id;
	public TouchStream(int x, int y, int id){
		this.x = x;
		this.y = y; = id;
// Usual getters and setters after here

to do is to extend a class of type View (which handles touch events). This way you can override the onTouchEvent(MotionEvent ev) method to process input.