Code example for MotionEvent.PointerCoords

0
    public boolean onTouch(View v, MotionEvent event) {
    	// TODO: Refactor 
		// Select corresponding list 
		LinkedList<LinkedList<MotionEvent.PointerCoords>> outerList = isForeground ? fgdStrokes : bgdStrokes;
		// Initialize coordinates object 
		MotionEvent.PointerCoords coordinates = new MotionEvent.PointerCoords();
		 
		// Distinguish in which phase we are 
		if (hasRect) {
			// 2nd phase 
			// Switch the different event types 
			switch (event.getAction()) {
				case MotionEvent.ACTION_DOWN:
					// We store the first position of the touch by generating a new list 
					event.getPointerCoords(0, coordinates);
					LinkedList<MotionEvent.PointerCoords> innerList = new LinkedList<MotionEvent.PointerCoords>();
					innerList.add(coordinates);
					outerList.add(innerList);
					break; 
				case MotionEvent.ACTION_MOVE:
					// We get the latest position information