Hi everyone I am creating an application that controls a car with an Arduino. I have four touch buttons, one forward, one backward, one left and one right. I don't understand how to use multitouch with these 4 buttons.
This is the code of the forward and left buttons:
//Forward
btFrente.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP){
envia("0");
return true;
}else if (event.getAction() == MotionEvent.ACTION_DOWN){
envia("1");
return true;
}
return false;
}
});
//Left
btEsquerda.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP){
envia("0");
return true;
}else if (event.getAction() == MotionEvent.ACTION_DOWN){
envia("3");
return true;
}
return false;
}
});
Envia is used to send the number to the arduino. I do need to send another number when I click on front button and left at the same time, for example. I need to do the same for front right, back left and back right.
How can I do this?