Lab 6 Clocks
Lab 6 Clocks
Android analog and digital clocks are used to show time in android application.
Android DigitalClock is the subclass of TextView class. Since Android API level 17, it is
deprecated. You are recommended to use TextClock Instead.
The AnalogClock was deprecated in API level 23. This widget is no longer supported. Instead if
you want to use AnalogClock in your application you need to hard code. It does not appear in
API level 27 to drag from palette.
In android, you need to drag analog and digital clocks from the pallet to display analog and
digital clocks.
activity_main.xml
Now, drag the analog and digital clocks, now the xml file will look like this.
File: activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/an
droid"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.analogdigital.MainActivity">
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="136dp"
android:layout_marginTop="296dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<DigitalClock
android:id="@+id/digitalClock1"
android:layout_width="wrap_content"
Activity class
File: MainActivity.java
package example.javatpoint.com.analogdigital;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TASK 1:
Develop an android application to have an analog clock as the above example. [10]
TASK 2:
https://www.codingconnect.net/mobile-application-development-lab/
https://www.javatpoint.com/android-tutorial
https://www.tutorialspoint.com/android
https://developer.android.com/guide
Https://developer.Android.com/training/basics/firstapp/creating-
project
Https://www.raywenderlich.com/120177/beginning-Android-development-tutorial-
installingAndroid-studio https://www.youtube.com/playlist?
list=PLS1QulWo1RIbb1cYyzZpLFCKvdYV_yJ-E Https://www.udemy.com/java-
tutorial/
Https://www.w3schools.com/xml/
Http://www.Androidguys.com/