In this blog, i am trying to display count down timer.
1. Xml code to display count down timer (main.xml)Take 4 textviews to display days, hours, minutes and seconds.
And a button to start the timer.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Countdown"
android:onClick="startCountDown"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="100dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25">
<TextView
android:id="@+id/days"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Days"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25">
<TextView
android:id="@+id/hours"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hours"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25">
<TextView
android:id="@+id/minutes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Minutes"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.25">
<TextView
android:id="@+id/seconds"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Seconds"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>