A user reported an ArrayIndexOutOfBoundsException today in our multi- touch handler. We store x/y/touchState on a per pointer id basis in an array. Dirty? Yes, but it worked on all devices so far. Usually pointer ids are handed out like this:
first finger goes down -> pointer Id 0 second finger goes down -> pointer id 1 second finger lifted second finger goes down -> pointer id 1 second finger lifted second finger goes down -> pointer id 1 This works on all phones and some discussions in this group also point out this exact behaviour. Sadly, MotionEvent is underdocumented so it seems this was an assumption after all, not a rule all manufacturers would follow. On the Sony Xperia Play the following behaviour is observed. first finger goes down -> pointer Id 0 second finger goes down -> pointer id 1 second finger lifted second finger goes down -> pointer id 2 second finger lifted second finger goes down -> pointer id 3 Is this a bug in the Xperia touch driver or is this actually wanted behaviour? Did we all (and there are a couple of people i know of having this issue) created faulty apps based on a wrong assumption? On a related note: The MotionEvent documentation has a new addition which reads like this: "The view implementation should be prepared to handle ACTION_CANCEL and should tolerate anomalous situations such as receiving a new ACTION_DOWN without first having received an ACTION_UP for the prior gesture." The handling of ACTION_CANCEL is a no-brainer of course. What is making me a bit nervous is the fact that spurious ACTION_DOWN events can now happen. It is not clear whether this will only happen if a parent View consumed the accompanying ACTION_UP event or if this is behaviour to be expected even in single View applications. Any pointers would be appreciated, no pun intended. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

