Multi touch doesnt work properly.

Hello!
So after alot of tries and reading online about multi touch I finaly almost got it to work.
This is my code:


   public boolean onTouch(MotionEvent e) {
    int pointerCount = e.getPointerCount();

    for (int i = 0; i < pointerCount; i++) {
        int x = (int) e.getX(i);
        int y = (int) e.getY(i);
        int action = e.getActionMasked();

        for (int j = 0; j < object.size(); j++) {
            tempObject = object.get(j);
            if (tempObject.getId() == ObjectId.Player) {

                switch (action) {

                case MotionEvent.ACTION_UP:
                    if (moveLeft.contains(x, y)) {
                        tempObject.setMovingLeft(false);

                    }
                    if (moveRight.contains(x, y)) {
                        tempObject.setMovingRight(false);

                    }

                    break;
                case MotionEvent.ACTION_POINTER_UP:
                    if (moveLeft.contains(x, y)) {
                        tempObject.setMovingLeft(false);

                    }
                    if (moveRight.contains(x, y)) {
                        tempObject.setMovingRight(false);

                    }

                    break;

                case MotionEvent.ACTION_DOWN:
                    if (jump.contains(x, y)) {
                        if (tempObject.getVelY() == 0 && tempObject.isJumping() == false) {
                            tempObject.setVelY((float) -11.5);
                            tempObject.setJumping(true);
                        }
                    }
                    if (restart.contains(x, y)) {
                        restart();

                    }

                    break;
                case MotionEvent.ACTION_POINTER_DOWN:
                    if (jump.contains(x, y)) {
                        if (tempObject.getVelY() == 0 && tempObject.isJumping() == false) {
                            tempObject.setVelY((float) -11.5);
                            tempObject.setJumping(true);
                        }
                    }
                    if (restart.contains(x, y)) {
                        restart();

                    }

                    break;

                case MotionEvent.ACTION_MOVE:

                    if (moveLeft.contains(x, y)) {
                        tempObject.setMovingLeft(true);
                        tempObject.setMovingRight(false);

                    }
                    if (moveLeftExit.contains(x, y) && !moveLeft.contains(x, y)) {
                        tempObject.setMovingLeft(false);

                    }
                    if (moveRight.contains(x, y)) {
                        tempObject.setMovingRight(true);
                        tempObject.setMovingLeft(false);

                    }
                    if (moveRightExit.contains(x, y) && !moveRight.contains(x, y)) {
                        tempObject.setMovingRight(false);

                    }
                    break;
                }
            }
        }

    }
    return true;
}

Now the good part is that the multi touch work,as in I can press two buttons and they both react.
The bad part is that they react when I touch a different and smaller place.(not in the rects they are supposed to)
I hope you can understand from this picture:

#black - Where it is suppose to trigger the touch event
#yellow- Where the touch event is triggered.

Thanks ! :slight_smile: