So, I m developing an app and need to have two buttons pressed at the same time. I need the events for the buttons to be triggered when pressed(which is at the same time, too).
一辆汽车——我已经离开、右边、前面和背。 我需要向前推进,并合力争取正确转变。
这里是我的手法,但出于某种原因,当我向各州发出新闻时,只触发了首先报警的县。 任何想法?
// Handle touches of the navigation arrows
public boolean onTouch(View v, MotionEvent theMotion) {
switch (theMotion.getAction()) {
// A button was PRESSED
case MotionEvent.ACTION_DOWN:
switch (v.getId()) { // Which button?
case R.id.freestyle_upArrow: // The upArrow
bt.sendNXTcommand(MOTOR_B_FORWARD, 720);
break;
case R.id.freestyle_downArrow: // The downArrow
bt.sendNXTcommand(MOTOR_B_BACKWARD, 720);
break;
case R.id.freestyle_leftArrow: // The leftArrow
bt.sendNXTcommand(MOTOR_A_LEFT, 720);
break;
case R.id.freestyle_rightArrow: // The rightArrow
bt.sendNXTcommand(MOTOR_A_RIGHT, 720);
break;
}
break;
// A button was RELEASED
case MotionEvent.ACTION_UP:
switch (v.getId()) { // Which button?
case R.id.freestyle_upArrow: // The upArrow
bt.sendNXTcommand(MOTOR_B_STOP, 0);
break;
case R.id.freestyle_downArrow: // The downArrow
bt.sendNXTcommand(MOTOR_B_STOP, 0);
break;
case R.id.freestyle_leftArrow: // The leftArrow
break;
case R.id.freestyle_rightArrow: // The rightArrow
break;
}
break;
}
return true;
}
因此,是否有任何想法? 这是否与我的屏幕上允许的点数有关?
PHONE SPECS:Samsunglaxy Ace entre Anders on firmware 2.2.1
Regards,
里。