So I come from the java world and normally when I want to loop I can just use something like:
while(true) {
//code here till false
}
but in Android I am noticing that that kind of loop, at least in my onCreate()
method causes an application to not be runnable. My loop I want to use is really short and calls some simple UI updates (changes the background color).
How can I implement a loop in Android that calls UI changes? Where do I put this loop? (clearly not onCreate
) Examples/sample code would be much appreciated.