I have a for loop, but I need it to stop doing anything until I get a response from the user (aka the user selects left or right). I’m doing this in Android, but I’m not sure of the best way to go about this. The “left” and “right” are images. So I’m listening for left or right to be hit before I keep moving on. I need the loop to go on about 50 times. This is what I have so far.
int testlength = 50;
for (int i = 0; i < testlength; i++) {
left.setImageResource(R.drawable.left);
right.setImageResource(R.drawable.right);
//Stop the for loop and get the input from the user
}
You don’t need a loop.
Just exit the routine once you have 50 responses: