8

I am successfully able to record the coordinates of the two fingers being touched on the screen using the following code:

case MotionEvent.ACTION_MOVE:
Log.d("TOUCH", "test ACTION MOVE" + event.getPointerCount());
Log.d("TOUCH", "test ACTION MOVE ID" + event.getPointerId(0) + " "+event.getPointerId(1));
if(event.getPointerCount()==3)
{

x0 = (int) event.getX(event.getPointerId(0));
y0 = (int) event.getY(event.getPointerId(0));
x1 = (int) event.getX(event.getPointerId(1));
y1 = (int) event.getY(event.getPointerId(1));
x2 = (int) event.getX(event.getPointerId(2));
y2 = (int) event.getY(event.getPointerId(2));

Log.d("TOUCH", "test ACTION DOWN " + " values = " + x0 + " " + y0 + " "
+ x1 + " " + y1+ " "+x2 + " " + y2);
}

But In the above code im not able to detect more then 2 touch points at a single instance. Even the pointerCount() never goes above 2.

How can I get the touch coordinates for more then 2 fingers? Im running this code on Android 2.2

Kshitij Aggarwal
  • 5,287
  • 5
  • 34
  • 41
  • Hi, I'm not sure that this help you but http://getandroidstuff.com/familiar-android-platform-android-3rd-edition-download-book/ Page 220, Chapter Multi-Touch. – Pasha May 05 '11 at 06:56

4 Answers4

2

This was asked some time ago, but anyway. The answer is that although android could track 256 fingers, the current implementation limits this to 2 fingers.

I'm not sure about honeycomb, but I guess that it has the same "issue".

Augusto
  • 28,839
  • 5
  • 58
  • 88
  • Well this sucks!!! :( Whats the point of having support if we cant actually use them – Kshitij Aggarwal Jul 14 '11 at 04:42
  • I agree, it's quite bad specially since the competition supports very nicely 3 finger gestures. The support is done so at some time the OMA (Open Mobile Alliance) can roll support for more than 2 finger without breaking backwards compatibility. – Augusto Jul 14 '11 at 07:11
  • I understand that it might be a rework for the Android Engg team but why cant we have it now? Who knows when OMA will come up with the support ???!!! – Kshitij Aggarwal Jul 19 '11 at 12:16
1

I've confirmed 4 touches on some Android 2.3.5 devices, and every 3.x and 4.x device I've tested so far. It seems that at least from API 8+, more than two touches is supported, but it's device-dependent.

Michael
  • 776
  • 6
  • 13
0

multitouch which uses more than two fingers can only be performed in android 4.1.2 version or above and also different companies have customized the android versions according to their needs and apps i.e in 4.1.2 version the Qmobile just support five fingures but the great samsung company uses more than 11 fingers

0
     firstFingerX = MotionEventCompat.getX(ev, 0); firstFingerY = MotionEventCompat.getY(ev, 0);
 if (numberOfFingers == 2) {
     Log.e("mine", "Integer: " + String.valueOf((int)MotionEventCompat.getY(ev, 1)));
     secondFingerX = MotionEventCompat.getX(ev, 1); secondFingerY = MotionEventCompat.getY(ev, 1);
 }
 if (numberOfFingers == 3) {
     Log.e("mine", "Integer: " + String.valueOf((int)MotionEventCompat.getY(ev, 2)));
     thirdFingerX = MotionEventCompat.getX(ev, 2); thirdFingerY = MotionEventCompat.getY(ev, 2);

 }
Bobby
  • 6,115
  • 4
  • 35
  • 36