• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Creating a CountDown Timer

Trying to create a simple 1 minute timer.

I want it to start once a user hits a button (in this case the button's ID is 'Tap'), and at 00:00, I want a message to popup.

I also have a reset button, when a user clicks that I want it to reset to 1:00. Thanks for any help.
 
Well, what have you got so far in regards to the timer? Basically, you'll want to have a data member for the lastRecordedTime, intializing it in System.currentTimeMillis() in onCreate(), then create a new TimerTask subclass and in the run() method, get the current time into a local variable, subtract lastRecordedTime from it, convert it to hours, minutes, seconds (or w/e combo of them you need), and set the text of a TextView to the result. Lastly, you'll want to set lastRecordedTime to the local variable you stored at the beginning of the run() method.
 
Back
Top Bottom