Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android multi-touch headaches

I've getting a real problem trying to deal with multi-touch events. Basically I need to detect if someone has released a finger while touching the screen elsewhere.

According to this previously answered question, I should be using MotionEvent.ACTION_POINTER_UP MotionEvent.ACTION_UP.

As far as I can tell, the following code should tell me if a finger has been lifted:

    int action = event.getActionMasked();
    mCurUp = ( action == MotionEvent.ACTION_UP ) || ( action == MotionEvent.ACTION_POINTER_UP );

What I am seeing in practice, is that this works some of the time. If I am really careful I can hold my left finger on the screen and lift my right finger and no events are fired at all! Usually at some point my left finger will wobble, generating a ACTION_MOVE event. At this point it generates an event (262) which I think correlates to ACTION_POINTER_UP

So I'm wondering if any other folks have seen this, and I also suspect it might be the notoriously poor touchscreen on my HTC Desire causing this. Or perhaps I am doing something fundamentally wrong. Does anyone have some tested code that can reliably detect lifting either finger from the touchscreen?

like image 896
Kevin Avatar asked Apr 22 '26 23:04

Kevin


1 Answers

it is possible that the weird behaviour is caused by your device (HTC Desire == Nexus One screen), rather than your code.

Do you know although Android support multi-touch, not every phone support real multitouch?

Have a read of this

http://androidandme.com/2010/03/news/is-multitouch-broken-on-the-nexus-one/

and this

http://groups.google.com/group/android-developers/msg/70e9dd235d519955

Cheers

like image 94
Rokey Ge Avatar answered Apr 25 '26 13:04

Rokey Ge