From reading on Stack Overflow I've seen that many of you don't recommend using Timer Task. Hmmm... but I already implemented this:
I have this code:
detectionHandlerTimer.schedule(myTimerTask, 60 * 1000, 60 * 1000);
The thing is that work of myTimerTask lasts some time.
I would like this behavior:
- wait 60 sec.
- do task for some time (e.g. 40 - 100 sec).
- task finished.
- wait 60 seconds.
- do task for some time (e.g. 40 - 100 sec).
But the code above behaves like this
- wait 60 sec.
- do task for some time (e.g. 40 - 100 sec).
- task finished
- do task for some time (e.g. 40 - 100 sec).
Because the time duration of task is bigger than 60, timer starts task immediately after task is finished. But I would like it to wait again.