M
M
MdaUZH2016-08-25 08:53:22
Android
MdaUZH, 2016-08-25 08:53:22

AsyncTask which is better TimerTask or Sleep?

Hello.
There is a task to count 8 seconds, but if the screen is turned, then do not start over, but continue from the place that was before the turn ...
Before that, I did TimerTask 8 times for 1 second (in the timer itself, I checked how many times the timer worked, and not just called 8 times))) )
But then I came across AsyncTask, it’s convenient and easy to work with + in my opinion it’s more convenient to save the state, but you can also use sleep (1) instead of a timer The
question in general is this: better to use - normal timer or sleep ?
In the case of Sleep, you don’t need to use extra classes of timers, etc., and it’s more convenient, but I’m a noob, so I’d better ask you)
Thank you very much)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question