I'm making a little reactionspeed app in Android Studio, which checks whether the user clicks the button that matches a randomly generated number. If the correct button was pressed, it executes the NewRound
method.
Currently, I have this:
public void ButtonOneClick(View view) {
if (rnd == 1) {
NewRound(view);
}
}
public void ButtonTwoClick(View view) {
if (rnd == 2) {
NewRound(view);
}
}
public void ButtonThreeClick(View view) {
if (rnd == 3) {
NewRound(view);
}
}
public void ButtonFourClick(View view) {
if (rnd == 4) {
NewRound(view);
}
}
public void ButtonFiveClick(View view) {
if (rnd == 5) {
NewRound(view);
}
}
Would there be a shorter and more efficient way to do this?