{"id":528,"date":"2019-10-16T20:59:17","date_gmt":"2019-10-16T10:59:17","guid":{"rendered":"https:\/\/learntodroid.com\/?p=528"},"modified":"2019-10-16T20:59:27","modified_gmt":"2019-10-16T10:59:27","slug":"how-to-create-a-count-down-timer-in-android","status":"publish","type":"post","link":"http:\/\/10.0.0.14:32769\/how-to-create-a-count-down-timer-in-android\/","title":{"rendered":"How to Create a Count Down Timer in Android"},"content":{"rendered":"\n
At the moment I am working on app to help keep me motivated on my goals by using a count down timer to track the time I spend on each of my goals everyday. I have put together this tutorial with what I have learnt on creating a count down timer in an Android app using Java.<\/p>\n\n\n\n
To create an Android app with a count down timer follow the steps below:<\/strong><\/p>\n\n\n\n We will be making a simple count down timer Android app written in Java in this tutorial. The code for this tutorial is available publicly in the Count Down Timer repo<\/a> in GitHub.<\/p>\n\n\n\n In this Count Down Timer app, we will support the ability to count down from a particular number of hours, minutes and seconds in the future. <\/p>\n\n\n\n Add three EditTexts in the user interface to capture the hours, the minutes and the seconds we want to count down from. Put a TextView above the hours, minutes and seconds to describe the units being entered. Between the EditText for hours and minutes and the EditText between minutes and seconds place a TextView with the colon “:” symbol.<\/p>\n\n\n\n Below is an excerpt from the layout file for the MainActivity activity_main.xml<\/a> which shows the layout for capturing the time we will be counting down from.<\/p>\n\n\nWhat functionality does the CountDownTimer offer?<\/h2>\n\n\n\n
Creating an App using CountDownTimer<\/h2>\n\n\n\n
Step 1: Capturing the Count Down Time<\/h3>\n\n\n\n