I am currently writing a game and would like the app to wait a certain amount of time before proceeding. I have tried the sleep function and it does not do what I would like it to. I have a loop for ten and in that I would like one of the text boxes to have its value changed ten times with a couple of seconds gap between each one. So far I have this
for(int coolRan = 0; coolRan < 11; coolRan = coolRan + 1) {
Random generator = new Random();
int RanNumGen = generator.nextInt(50) + 1;
String RanNum = Integer.toString(RanNumGen);
higherTxt.setText(RanNum);
}
What I would like it to do after this is pause for a few seconds before performing the operation in the loop again so in Pseudocode this is what it looks like:
Loop For Ten
Generate Random Number With Maximum Value Of 50
Set A String To Equal The Random Number
Set A TextView To Equal The Random Number
Wait A Few Seconds
Perform Operation Again