Changes

Jump to: navigation, search

Android Touch and Multi-touch Event Handling

2 bytes removed, 16:05, 3 July 2014
Handling Multiple Touches
== Handling Multiple Touches ==
The previous chapter began exploring event handling within the narrow context of a single touch event. In practice, most Android devices possesses possess the ability to respond to multiple consecutive touches (though it is important to note that the number of simultaneous touches that can be detected varies depending on the device).
As previously discussed, each touch in a multi-touch situation is considered by the Android framework to be a pointer. Each pointer, in turn, is referenced by an index value and assigned an ID. The current number of pointers can be obtained via a call to the getPointerCount() method of the current MotionEvent object. The ID for a pointer at a particular index in the list of current pointers may be obtained via a call to the MotionEvent getPointerId() method. For example, the following code excerpt obtains a count of pointers and the ID of the pointer at index 0:

Navigation menu