This seems to be a common question, “how do I pause a countdowntimer”?
I found this code which looks promising:
I’m just not sure how to implement it in code. I need to override the abstracted methods and extend the class. Can someone give me an idea how to do this?
Here is your layout
Here is your activity class
Do not forget to copy CountDownTimerWithPause into your package.
Works for me, BUT…
I mention some bugs but it depends on your application. Maybe it’s OK for you. Bug is – when starting timer, it fires immediatelly. ‘So what?’ you might ask. Imagine you click Stop button when 3 and half seconds passed. So when you click Start button you expect half second pass before you see 4, but not in that class implementation.
And there is some strange delay at the end of counting. I’d recommend to search for better implementation.