+ 2
How can we slow down a loop in java ?
While doing some java coding in Android studio, i have stuck to a problem. I have to slow down a while loop i.e. there must be a atleast 1sec gap between each loop perform. Please help ... how can i do this..
2 Réponses
+ 7
Are you looking for something like this ?
while (/*condition*/) {
/*do stuff*/
Thread.sleep(timeInMills);
}
+ 2
Using some sort of timer would be an alternative. It might be a little bit more work but in my oppinion sleep functions are cheesy x)