I know this question is somewhat beaten but i haven’t been able to get an answer to my specific problem.
I have several components that use TimerTask that i need to pause and resume afterwards.
What is the best way to do it? (Even if not with the Timer/TimerTask system)
Thanks in advance
JQCorreia
Use
Handler. With this you can post aRunnableto run usingHandler.post(yourRunnable) and remove it by usingHandler.removeCallbacks(yourRunnable). There are also methods in the API to make theRunnableexecute after a specified delay.Combine these two methods to implement a pause / resume function in your application.