Question

I'm having a real issue here which I'm desperately trying to figure out since the last couple of hours. Not getting anywhere...

While writing an application in which I need to process the exact positions of two fingers on the screen, I ran into an unexpected behavior (for me). After some debugging I figured out that when I keep one finger at a static position on the screen while sliding with another finger across the same screen changes the coordinates not only of the moving but also of the static finger! (not in real life though :D)

Here is a sample log output of only the y-coordinates.
y(0) is the static finger held at the bottom of the screen and
y(1) was moving from top to bottom.

It is also interesting, that y(1) reached the maximum of 480 before I reached the bottom of the screen.

Can somebody please explain this behavior to me?

Here is the code I used to generate the log, maybe I made a silly mistake...

Edit: Tested on a "htc desire".

    @Override
    public boolean onTouchEvent( MotionEvent e ) {
        String s = "";
        for ( int i = 0; i < e.getPointerCount(); i++ ) {
                s += "y(" + i + ")=" + (int)e.getY( i ) + " ";
        }
        Log.d( "some tag", s );
        return true;
    }
  • 09-11 17:57:09.257: D/TouchHandler(14932): y(0)=480
  • 09-11 17:57:09.267: D/TouchHandler(14932): y(0)=480 y(1)=5
  • 09-11 17:57:09.287: D/TouchHandler(14932): y(0)=480 y(1)=10
  • 09-11 17:57:09.327: D/TouchHandler(14932): y(0)=480 y(1)=30
  • 09-11 17:57:09.367: D/TouchHandler(14932): y(0)=480 y(1)=70
  • 09-11 17:57:09.427: D/TouchHandler(14932): y(0)=480 y(1)=121
  • 09-11 17:57:09.528: D/TouchHandler(14932): y(0)=480 y(1)=206
  • 09-11 17:57:09.608: D/TouchHandler(14932): y(0)=480 y(1)=271
  • 09-11 17:57:09.618: D/TouchHandler(14932): y(0)=480 y(1)=281
  • 09-11 17:57:09.628: D/TouchHandler(14932): y(0)=447 y(1)=293
  • 09-11 17:57:09.638: D/TouchHandler(14932): y(0)=447 y(1)=304
  • 09-11 17:57:09.658: D/TouchHandler(14932): y(0)=428 y(1)=311
  • 09-11 17:57:09.668: D/TouchHandler(14932): y(0)=419 y(1)=317
  • 09-11 17:57:09.678: D/TouchHandler(14932): y(0)=415 y(1)=325
  • 09-11 17:57:09.688: D/TouchHandler(14932): y(0)=413 y(1)=333
  • 09-11 17:57:09.698: D/TouchHandler(14932): y(0)=411 y(1)=351
  • 09-11 17:57:09.708: D/TouchHandler(14932): y(0)=411 y(1)=363
  • 09-11 17:57:09.718: D/TouchHandler(14932): y(0)=411 y(1)=373
  • 09-11 17:57:09.728: D/TouchHandler(14932): y(0)=411 y(1)=383
  • 09-11 17:57:09.748: D/TouchHandler(14932): y(0)=480 y(1)=480
  • 09-11 17:57:09.758: D/TouchHandler(14932): y(0)=459 y(1)=438
  • 09-11 17:57:09.768: D/TouchHandler(14932): y(0)=459 y(1)=432
  • 09-11 17:57:09.778: D/TouchHandler(14932): y(0)=445 y(1)=431
  • 09-11 17:57:09.788: D/TouchHandler(14932): y(0)=439 y(1)=432
  • 09-11 17:57:09.798: D/TouchHandler(14932): y(0)=437 y(1)=436
  • 09-11 17:57:09.818: D/TouchHandler(14932): y(0)=439 y(1)=441
  • 09-11 17:57:09.828: D/TouchHandler(14932): y(0)=443 y(1)=447
  • 09-11 17:57:09.838: D/TouchHandler(14932): y(0)=450 y(1)=456
  • 09-11 17:57:09.838: D/TouchHandler(14932): y(0)=459 y(1)=467
  • 09-11 17:57:09.858: D/TouchHandler(14932): y(0)=469 y(1)=480
  • 09-11 17:57:09.868: D/TouchHandler(14932): y(0)=476 y(1)=480
  • 09-11 17:57:09.878: D/TouchHandler(14932): y(0)=479 y(1)=480
  • 09-11 17:57:09.888: D/TouchHandler(14932): y(0)=480 y(1)=480
Was it helpful?

Solution

Well, I was looking all over the internet for quite some time now.
I came across this article which describes the problem even with a short video and links to an app on google.play which can be used to reproduce this behavior on certain devices.

Dianne Hackborn, a google engineer commentated this on the official Android Developer Group.

It seems that this is not an Android-Bug since Android is only working with the data coming from the hardware. Therefore it is most likely a driver issue or something that we developers have no control over.

Now I'm on the lookout for a workaround since I really need accurate multitouch gestures in my application. Help will be greatly appreciated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top