One of the popular widgets in Android is the clock. It is available in two different variants, Analog and Digital. Both the variants are capable of display the current time for the device. By default, the clock cannot change the time on the device. However, we can use “Timepicker”, and “Datepicker”. This can be easily created in the Android Studio. The sample code for the Analog and Digital clock is shown below.
While you create the Analog and Digital clock in Android, you have to remember that Analog is a subclass of the View class, whereas digital is a subclass of TextView class.
The AnalogClock is a two-handed clock, with one hand indicating the hour and the other the minute. The DigitalClock resembles a traditional digital clock, displaying hours, minutes, and seconds in digital format.
The android.widget.AnalogClock and android.widget.DigitalClock classes display analog and digital clocks, respectively.
|