}
public synchronized boolean startButtonDetection(int joy, JoystickButtonDetectionListener listener) {
stopButtonDetection();
if (joy < 0 || joy > 1 || !started) return false;
Joystick joystick = joy == 0 ? joystick0 : joystick1;
if (joystick == null) return false;
joyButtonDetection = joystick;
joyButtonDetectionListener = listener;
return true;
}