Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PointerIndex versus id in android

I m referring to some websites like http://developer.android.com/reference/android/view/MotionEvent.html http://www.vogella.com/tutorials/AndroidTouch/article.html to learn MotionEvent for designing User Interface. The problem is i am getting confused with terminologies like pointerIndex,Id ,getActionIndex, getActionMasked and other important methods related to MotionEvent.

like image 266
user3212719 Avatar asked Jan 11 '23 00:01

user3212719


1 Answers

  • Pointer index tells us which pointer in the current set of pointers the event is for

  • Pointer ID is a unique ID assigned to every pointer

The pointer index of a pointer may change, but its ID will remain the same. This is best explained with an example.

Say you have a pointer on the screen, and then touch the screen with a second pointer. Each of these pointers will have their ids and indices. Say you now remove the first pointer.

Alas! The secondary pointer now becomes the primary pointer! So its index will be changed to that of the previous pointer that was just removed i.e. its index has changed from 1 to 0. But its id will remain the same.

like image 121
Sameer Khanal Avatar answered Jan 17 '23 14:01

Sameer Khanal