Changes

Jump to: navigation, search

Kotlin - Android Touch and Multi-touch Event Handling

27 bytes added, 21:41, 30 November 2017
no edit summary
A touch on a view, particularly one involving motion across the screen, will generate a stream of events before the point of contact with the screen is lifted. As such, it is likely that an application will need to track individual touches over multiple touch events. While the ID of a specific touch gesture will not change from one event to the next, it is important to keep in mind that the index value will change as other touch events come and go. When working with a touch gesture over multiple events, therefore, it is essential that the ID value be used as the touch reference in order to make sure the same touch is being tracked. When calling methods that require an index value, this should be obtained by converting the ID for a touch to the corresponding index value via a call to the findPointerIndex() method of the MotionEvent object.
<htmlet>as30kotlin</htmlet>
== An Example Multi-Touch Application ==

Navigation menu