I am developing an Android app that has a page that requires a connection to be active AND requires a certain piece of information to be collected from the device before allowing users to move to the next step.
I was using an AsyncTask to check both of these booleans. If either of them were 'false', it would display a Toast. It would then Thread.sleep for 1 second, check again and toast again until both booleans are true or they have left the page.
The problem, we learned yesterday, is that Thread.sleep sleeps all Async tasks in the threadpool. So it was also sleeping the Connection AsyncTask and preventing us from ever being able to successfully connect.
My alternate plan was to switch my current Task to a scheduled Timer, until I read that it "is discouraged in Android" (but the link to the article is broken): Android Asynctask vs Runnable vs timertask vs Service
I feel that spawning a thread to check the status of two booleans is not a good idea in the first place, but I'm not sure how else to handle it. Thank you for your suggestions!
EDIT: I have reworded the question to be more clear.