AndroidHow To

Learn to Develop A Simple Count Down Timer Application

How to make simple countdown 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
How To

How to Bring Your Product to Market Faster

If you watch tech YouTube channels, you are most likely familiar with Linus Tech Tips (LTT) and the…
Read more
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
Newsletter
Become a Trendsetter

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

[mc4wp_form id="729"]