![]() |
![]() ![]() ![]() |
Create a simple application to handle multiple pointers directly in a multi-touch gesture.
The objective of the application is to track two finger pointers as they travel around the screen.
As shown in the figure below, the primary pointer is tracked by a large black rectangle.
The primary pointer represents the first pointer placed on the screen.
The secondary pointer is tracked by a smaller black rectangle. As the primary and secondary fingers are placed on the touchscreen, their pointer identifiers are accessed using their pointer data index. These identifiers provide the actual pointer number associated with the MotionEvent data, accounting for individual pointers going up and down since the start of the gesture. Once the ACTION_MOVE MotionEvent is triggered, a pointer identifier is used to find the index of its data in the event. Each pointer is tracked by repositioning the rectangle objects at the location of their targeted pointers. If either of the pointers is removed from the touchscreen, the fingers are no longer tracked by the rectangles. If only one finger is placed on the touchscreen, as a primary pointer, it will be tracked by the larger rectangle. |
![]() |
![]() |
Drawables:
![]() ![]() ![]() ![]() ![]() |