Digital Clock Widget in Android.

By | February 12, 2012

Digital Clock is a very useful widget in android to show time in your application.
Here is a simple demo on using digital Clock widget.

First In the layout file copy this file.

This creates a digital clock widget in the UI which will automatically update the time from the device.

Now in the java file you can reference it like this.
Since Digital Clock extends TextView you can apply every methods that you apply on a TextView.

        DigitalClock dg;
        dg = (DigitalClock)findViewById(R.id.DigitalClock01);
        dg.setTextColor(Color.RED);
        dg.setTextSize(25f);

Digital Clock Demo in Android

Please leave your comments on this post.

Leave a Reply

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