Android Analog Clock and Digital Clock Example with Code Description

android-logoUsing Android Analog Clock and Digital Clock in any Android Application is very easy. We just need to put the Android clock control in the xml file, Then it will automatically pick the time and show on the Activity screen. Here is the complete code.

Please Note: DigitalClock class is deprecated from ‘API level 17′, So please use TextClock instead of DigitalClock  if you need. Also if you want to change the time using clock, then you have to use TimePicker control instead of AnalogClock and DigitalClock control.


1. Create a new project:

Project Name: AnalogDiditalClock

2. Android AnalogClock and DigitalClock entry in xml file

Path: \res\layout\activity_analog_digital_clock.xml. Add below code snippet in your Activity’s xml file.

 3. Java Code (Your Activity Class)

This is your default Android activity which will display the clock controls on it.

4. Build and Run your Application

Build and run the application on the  device or emulator and enjoy. I hope this small tutorial will help you at it’s best.

downloadDownload Android AnalogClock and DigitalClock Example from here.


Post By SmrutiRanjan (57 Posts)

Working @ Samsung as a Project Lead for Android Smartphones. I have been blogging since 2008. Previously I was writing articles for other bloggers, but finally I have started my own blog-"Techblogon".I am also an active contributor for the blog-"Gadgets n Gizmos World". Job is my necessity, but blogging is my passion.

Website: → Techblogon


One Response to Android Analog Clock and Digital Clock Example with Code Description

  1. Thanks designed for sharing such a nice opinion, paragraph is fastidious, thats why i have read it fully

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + = fourteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">