The digital clock supports seconds in addition to hours and minutes.
The control is just for displaying the current time.
The following layout xml has a DigitalClock
widget.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <DigitalClock android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout>
Java code
package com.java2s.app; /*from w w w . java 2 s. co m*/ import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }