Android: How to pause and resume a Count Down Timer?

后端 未结 8 1647
长发绾君心
长发绾君心 2020-12-02 17:20

I have developed a Count Down Timer and I am not sure how to pause and resume the timer as the textview for the timer is being clicked. Click to start then click again to pa

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 18:08

    Well there are no API to pause or resume it. What you should do is cancel() the timer and store the time remaining in a variable. When the resume button is hit again, restart the timer with the value from the variable.


    You know Chronometers may be of interest to you.

提交回复
热议问题