AndroidHow To

Learn to Develop A Simple Count Down Timer Application

Hello, nice to meet you again.

Today, I will develop a simple count down timer application. This is only a simple application which show you how to create a function to let time count down. You can use it in your larger application like Alarm Alert, …

Now, let’s do it.

First, create new Android project. I always use Android 2.3.3 for Minium Required SDK, lasted Android version (now is 4.3) in Target SDK and Android 2.3.3 for Compile With. OK, Next and Next. I finish creating new project.

IN MAIN_ACTIVITY.XML

Create a TextView

 

OK, we switch to MainActivity.java file

IN MAINACTIVITY.JAVA FILE

Create a CountDownTimer object.

Create a TextView object.

In onCreate, write a code to create a new CountDownTimer which has 2 parameters

First Parameter: the total time (ex: 2 minutes 30 seconds, we change to milliseconds: 150000).

Second Parameter: the time which the action will repeat.

onTick: will be called after a time.

onFinish: will called after the total time finishes.

 

We also have to write a function called format Time which has parameter millis.

OK, it is ok. I will test it to know that if it works well or not.

Yeah, it works well. Hope you can do that.

About author

Articles

Morris is a Technology enthusiast and a writer by night. He has been a part of TheTechly for quite some time and he contributes knowledgeable news articles from the Technology niche.
Related posts
BusinessHow To

How to Keep Your Business Online – No Matter What

If you’re selling the majority of your products and services online, then even an hour of…
Read more
How To

How to recognize a Forex Trading Scam?

Forex trading is not a scam in itself. It is a legitimate way to make money. And Forex has grown in…
Read more
How To

4 Ways Politicians Can Raise Donations

Political campaigns are costly regardless of the position you are running for. Over the years this…
Read more
Newsletter
Become a Trendsetter

Sign up for TheTechly’s Daily Digest and get the latest and trending technology updates.

[mc4wp_form id="729"]