Skip to content

Tag: timer

How to pause and resum a timer in Java

I have a small game where I need to pause the timer when the user press Pause button and after to resume the timer and to continue to increase the seconds when the user press the Resume button. I researched a lot and I tried different solutions but none worked for me. Can you please help me to achieve this

ScheduledExecutorService or ScheduledThreadPoolExecutor

I’m building an Android App which have to periodically do something in a Service. And I found that using ScheduledThreadPoolExecutor and ScheduledExecutorService is preferable to Timer. Can anyone explain the difference between ScheduledExecutorService and ScheduledThreadPoolExecutor and which one is more suitable for Android? Update I just found this article and this post explain the difference between several way to implement