I have programmed the following method in an attempt to get multi touch to work on the android, the problem is that when two fingers are on the screen they both receive the same getX() value, I need to get the location of each finger.
How can I get the location of both fingers? Thanks
public void onTouchEvent(MotionEvent event)
{
int pointerCount = event.getPointerCount();
stats = "";
for (int i = 0; i < pointerCount; i++)
{
stats += " " + i + " " + event.getAction() + " " + event.getX();
float x = event.getX(i);
System.out.println(stats);
}
}
here is an example of the print out: 0 2 200 1 2 200
You are currently calling
getX()without any parameters in the string you are logging out, which will always get the location of the first pointer. If you want to get the position for a particular pointer (finger), you need to callgetX(int)and pass the pointer id that you want to read, like you did below setting the float value.