0% found this document useful (0 votes)
2 views45 pages

Android Programming

The document is a laboratory manual for Android Programming (IT-606) aimed at third-year Information Technology students. It outlines the vision and mission of the IT department, program educational objectives, course outcomes, and specific programming tasks related to Android application development. Key topics include Android architecture, user interface design, and practical exercises for creating Android applications using various layouts and features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views45 pages

Android Programming

The document is a laboratory manual for Android Programming (IT-606) aimed at third-year Information Technology students. It outlines the vision and mission of the IT department, program educational objectives, course outcomes, and specific programming tasks related to Android application development. Key topics include Android architecture, user interface design, and practical exercises for creating Android applications using various layouts and features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Laboratory Manual

Android Programming
(IT-606)

For
Third Year Students
Department: Information Technology

1
Department of Information Technology

Vision of IT Department

The Department of Information Technology envisions preparing technically competent problem


solvers, researchers, innovators, entrepreneurs, and skilled IT professionals for the development of
rural and backward areas of the country for the modern computing challenges.

Mission of the IT Department

• To offer valuable education through an effective pedagogical teaching-learning process.


• To shape technologically strong students for industry, research & higher studies.
• To stimulate the young brain entrenched with ethical values and professional behaviors for the
progress of society.
Programme Educational Objectives

Graduates will be able to


 Our engineers will demonstrate application of comprehensive technical knowledge for
innovation and entrepreneurship.

 Our graduates will employ capabilities of solving complex engineering problems to


succeed in research and/or higher studies.

 Our graduates will exhibit team-work and leadership qualities to meet stakeholder business
objectives in their careers.
 Our graduates will evolve in ethical and professional practices and enhance socioeconomic
contributions to the society.

2
Program Outcomes (POs)
Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


Fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problemsand
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, andenvironmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modelling to complex engineering
activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilitiesand
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member orleader
in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, andgive and
receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of
theengineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological ch

3
Course Outcomes

Android Programming (IT 606)

CO1: Experiment on Integrated Development Environment for Android Application


Development.
CO2 : Design and Implement User Interfaces and Layouts of Android App.

CO3 : Use Intents for activity and broadcasting data in Android App.

CO4 : Design and Implement Database Application and Content Providers.

CO5 : Experiment with Camera and Location Based service and develop Android App with
Security features.

4
Course Course Outcomes CO
Attainment
Experiment with
Camera and Location
Based service and
CO1 2 0 0 0 0 0 0 0 0 0 0 0 1 1
develop Android
App with Security
features.
Design and
Implement User
CO2 Interfaces and 0 2 0 1 1 0 0 0 1 0 0 0 1 1
Layouts of Android
App.
Use Intents for
activity and
CO3 1 1 2 1 2 0 0 0 0 0 0 0 2 1 0
broadcasting data in
Android App.
Design and
Implement Database
CO4 1 1 0 1 0 0 0 0 0 0 0 0 1 1
Application and
Content Providers.
Experiment with
Camera and Location
Based service and
0 1 2 0 1 1 0 0 1 0 0 0 2 1 0
develop Android
CO5
App with Security
features.

5
List of Program

S. List Course Outcome Page No.


No.
1. Installation of Android studio. CO3 1-4
Development Of Hello World Application
2. CO3 5-11
Write program for building a single user interface
3. CO3 12-14
using a XML for UI layout
Write program for developing and Android
4. application using a linear layout. CO2,CO4 15-18

Write program for developing an Android


5. application using a relative layout. CO4 19-21

Write program for developing an Android


6. application using a table layout CO4, CO3 22-25

Write program for developing an Android


7. application using a absolute layout CO4 26-27

Write program for developing an Android


8. CO3,CO4 28-32
application using a frame layout
Developing and Android application using relative
9. layout to display date and time CO3, CO5 33-37

6
1. Introduction to android.

Objective: Student should get the knowledge of android operating system


background.

Outcome: Student will be aware of the android operating system.


Android Architecture.

Different numbers of components make up the Android architecture, which supports


the needs of any Android device. The open-source Linux Kernel that powers Android
apps is made up of several C/C++ libraries that are made available via application
framework services. Of all the parts, the Linux Kernel gives smartphones its primary
operating system functionality, and the Dalvik Virtual Machine (DVM) offers a
foundation on which to run Android applications. The following are the key elements
of Android architecture:

Applications
Application Framework
Android Runtime
Platform Libraries
Linux Kernel

Applications –
The top layer of the Android architecture is called Applications. Only this layer will
have the installed third-party apps (such games and chat apps) and pre-installed apps
(including contacts, camera, gallery, and home) from the play store. With the aid of
the classes and services the application framework offers, it operates inside the
Android run time.

Application framework –
A number of crucial classes are provided by the Application Framework and are
needed to construct an Android application. It assists in controlling the user interface
with application resources and offers a general abstraction for hardware access.
Generally speaking, it offers the services that enable us to develop a certain class and
make it useful for the building of applications. It contains a variety of services, such as
package manager, view system, activity manager, notification manager, and others,
that are useful for developing our application in accordance with the requirements.

1
Application runtime –
One of the most crucial components of Android is the Android Runtime
Environment. It includes elements such as the Dalvik virtual machine (DVM)
and core libraries. It primarily serves as the foundation for the application
framework and, with the aid of the core libraries, powers our application.
Similar to Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a
register-based virtual machine designed specifically for Android and
optimized to run many instances of the program on a device seamlessly. The
Linux kernel layer is responsible for threading and low-level memory

2
management. Because of the fundamental libraries, we can create Android
applications using the standard Java or Kotlin programming languages.

Platform libraries –
 To enable Android development, the Platform Libraries comprise a number
of Java-based and C/C++ essential libraries, including Media, Graphics, Surface
Manager, OpenGL, and others.
• Support for playing and recording audio and video formats is offered by the
media library.

The surface manager, which is in charge of controlling display subsystem


access.

• For 2D and 3D computer graphics, there are two cross-language and cross-platform
application program interfaces (APIs): SGL and OpenGL.
• FreeType offers font support, while SQLLite offers database functionality.
• Web-Kit The entire feature set for displaying web content and streamlining page
loading is provided by this open source web browser engine.
• A secure technology called Secure Sockets Layer creates an encrypted connection
between a web server and a web browser.

Linux Kernel –
 The core of the Android architecture is the Linux kernel. It controls all of the
drivers that are needed during runtime, including those for displays, cameras,
Bluetooth devices, audio devices, memory cards, and more. An abstraction layer
between the hardware of the device and the other elements of the Android
architecture will be provided by the Linux Kernel. Memory, power, device
management, and other things fall under its purview. The Linux kernel's
characteristics are:

• Security: The protection of the application from the system is handled by the
Linux kernel.

• Memory Management: It effectively manages memory, giving us the flexibility to


create our apps.

• Process Management: It effectively oversees the process and allots resources to it


as needed.

• Network Stack: It manages network communication efficiently.

3
• Driver Model: This guarantees that the program functions correctly on the
hardware and that the hardware manufacturers are in charge of integrating their
drivers into the Linux build.

4
2. Development of hello world application.

The first step in designing an Android application that displays Hello World is to use
Android Studio to construct a basic Android application. The screen that appears when
you click on the Android Studio icon is as follows.

To begin developing an application, select Start a New Android Studio Project.


Asking for the application name, package details, and project location should appear
in a new installation frame.

5
Set Up the Specifics of the Hello World Project
By setting up the project's name, location, and API version, we'll complete its creation.

6
Modify the application's name. You can either leave the project's default location
alone or change it to your chosen directory.
Make sure that API 15: Android 4.0.3 IceCreamSandwich is selected as the Minimum
SDK for the minimum API level. This guarantees that practically every device can use
your application.

The next step in the installation process should be choosing the mobile activity, which
sets the application's default layout.

7
SOURCE CODE :
The Main Activity File
The main activity code is a Java file MainActivity.java. This is the actual application
file which
ultimately gets converted to a Dalvik executable and runs your application
package com.example.helloworldapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

The Layout File


The activity_main.xml is a layout file available in res/layout directory, that is
referenced by your
application when building its interface. You will modify this file very frequently to
change the
layout of your application. For your "Hello World!" application, this file will have
following content
related to default layout −
8
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity" />

I )Running app on Phone:


Connect your Phone to Computer
Plug in your device to your computer with a USB cable. If you're developing on
Windows, you might need
to install this universal ADB USB driver or find your specific USB driver for your
device.
Enable USB Debugging

The next step is to enable USB debugging so your phone can interact with your
computer in a developer mode.

The following steps are needed:


1. (Windows Only) Install this ADB Driver
2. Plug-in your Android Device to Computer via USB
3. Open the "Settings" App on the Device
4. Scroll down to bottom to find "About phone" item
5. Scroll down to bottom to find "Build number" section
9
6. Tap on "Build Number" 7 times in quick succession
7. You should see the message "You are now a developer!"
8. Go back to main "Settings" page
9. Scroll down bottom to find "Developer options" item
10. Turn on "USB Debugging" switch and hit "OK"
11. Unplug and re-plug the device
12. Dialog appears "Allow USB Debugging?"
13. Check "Always allow from this computer" and then hit "OK"

Running your App

Now, we can launch apps from Android Studio onto our device:
1. Select one of your projects and click "Run" from the toolbar.
2. In the "Choose Device" window that appears, select the "Choose a running device"
radio button, select the
device, and click OK.
II) Running app on Emulator(AVD)
To run the app from Android studio, open one of your project's activity files and click
Run icon from the toolbar. Android studio installs the app on your AVD and starts it
and if everything is fine with your set-up and application, it will display following
Emulator window −Once Gradle finishes building, Android Studio should install the
app on your connected device and start it.

10
11
3. Program for building a simple user interface using a XML for UI
layout
Aim:- Program for building a simple user interface using a XML for
UI layout
Objective: Student should be able to design their own UI for android
application using XML.

Outcome:- Student will demonstrate the basic application using UI in android.


Software:
Microsoft Windows (07 or later)
The Android SDK (Starter Package)
Java Development Kit (JDK) 5 or 6.
Eclipse
Code:
Activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<EditText
android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
</LinearLayout>
Res/values/Strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">second</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>

12
13
14
4. Program for developing an Android Application using a linear layout.

Aim:- Program for developing an Android Application using a linear layout Objective:

Student should be able to design android application using linear layout.

Outcome: Student will demonstrate the android application using linear layout.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

The Linear Layout is one of the simplest layout classes. It allows you to create simple UIs
(or UI elements) that align a sequence of child Views in either a vertical or a horizontal
line. Linear Layout is a view group that aligns all children in a single direction, vertically
or horizontally.
Code:

Activity_main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/btnStartService" android:layout_width="150dp"
android:layout_height="wrap_content" android:text="@string/start_service" />

<Button android:id="@+id/btnPauseService" android:layout_width="150dp"


android:layout_height="wrap_content" android:text="@string/pause_service" />

15
<Button android:id="@+id/btnStopService" android:layout_width="150dp"
android:layout_height="wrap_content" android:text="@string/stop_service" />

</LinearLayout>

Res/values/Strings.xml:

<?xml version="1.0" encoding="utf-8"?>


<resources>

<string name="app_name">linearapp</string>
<string name="menu_settings">Settings</string>
<string name="start_service">Start</string>
<string name="pause_service">Pause</string>
<string name="stop_service">Stop</string>

</resources>

Output:

16
17
Result: - Students design android application using linear layout.

Conclusion: Thus, students understood how to demonstrate an android application


using linear

18
5. Program for developing an Android Application using a Relative
layout

Aim:- Program for developing an Android Application using a Relative layout.

Objective: Student should be able to design android application using relative layout.

Outcome: Student will demonstrate the android application using relative layout.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

The Relative Layout provides a great deal of flexibility for your layouts, allowing you
to define the position of each element within the layout in terms of its parent and other
views. Relative Layout is a view group that displays child views in relative positions.

Code:

Activity_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">

<Button android:id="@+id/btnStartService" android:layout_width="100dp"


android:layout_height="wrap_content" android:text="@string/start_service"/>
<Button android:id="@+id/btnPauseService" android:layout_width="350dp"
android:layout_height="wrap_content" android:text="@string/pause_service"
/>

19
<Button android:id="@+id/btnStopService" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_alignParentRight="true"

android:layout_alignParentTop="true" android:text="@string/stop_service" />


</RelativeLayout>

Res/values/Strings.xml:

<?xml version="1.0" encoding="utf-8"?>


<resources>

<string name="app_name">third</string>
<string name="menu_settings">Settings</string>
<string name="start_service">Start</string>
<string name="pause_service">Pause</string>
<string name="stop_service">Stop</string>

</resources>

OUTPUT:

20
Result: - Students design an android application using relative layout.

Conclusion: Thus, students understood how to demonstrate an android application using


relative layout.

21
6. Program for developing an Android Application using a Table
layout

Aim:- Program for developing an Android Application using a Table layout.

Objective: Student should be able to design android application using Table layout.

Outcome: Student will demonstrate the android application using Table layout.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

Table Layout is a view that groups views into rows and columns.

Code:

Activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow>
<Button android:id="@+id/backbutton"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Back" />
</TableRow>

<TableRow>

22
<TextView>

android:text="FirstName" android:layout_width="wrap_content"
android:layout_height="wrap_content"android:layout_column="1" />

<EditText
android:width="100dp" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>

<TableRow>

<TextView android:text="Last Name"


android:layout_width="wrap_content android:layout_height="wrap_content"
android:layout_column="1" />
<EditText android:width="100dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</TableRow>

</TableLayout>

Res/values/Strings.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>

<string name="app_name">tablelayout</string>
<string name="menu_settings">Settings</string>

</resources>

Output:

23
24
Result: - Students design an android application using table layout.

Conclusion: Thus, students understood how to demonstrate an android application using


table layout.

25
7. Program for developing an Android Application using Absolute
layout

Aim:- Program for developing an Android Application using Absolute layout.

Objective: Student should be able to design android application using absolute layout.

Outcome: Student will demonstrate the android application using absolute layout.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

Absolute Layout enables you to specify the exact location of its children.

Code:

Activity_main.xml:

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button android:layout_width="100dp"
android:layout_height="wrap_content" android:text="ok" android:layout_x="50dp"
android:layout_y="361dp" />

<Button
android:layout_width="
100dp"
android:layout_height="wrap_content" android:text="Cancel" android:layout_x="225dp"
android:layout_y="361dp" />

26
</AbsoluteLayout>

Res/values/Strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">absolutelayout</string>
<string name="menu_settings">Settings</string>

</resources>

Output:

Result: - Students design an android application using absolute layout.


Conclusion: Thus, students understood how to demonstrate an android application using
absolute layout.

27
8. Program for developing an Android Application using a Frame
layout.

Aim:- Program for developing an Android Application using a Frame

layout. Objective: Student should be able to design android application

using Frame layout. Outcome: Student will demonstrate the android

application using Frame layout.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

The Frame Layout is a placeholder on screen that you can use to display a single view.

Code:

a. MainActivity.Java code

package

com.example.framelayo

ut;import

android.os.Bundle;
import android.app.Activity;
28
public class MainActivity

extends Activity { @Override


protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

}
}

b. activity_main.xml code

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<ImageView
android:src="@drawable/ic_launcher"
android:scaleType="fitCenter"
android:layout_height="250dp"
android:layout_width="250dp"/>

<TextView
android:text="Frame
Demo"
android:textSize="30
sp"
android:textStyle="b
old"
android:layout_height="fill_
parent"
android:layout_width="fill_
parent"
android:gravity="center" />

</Frame
29
Layout>

Res/valu

es/String

s.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">framelayout</string>
<string name="menu_settings">Settings</string>

</resources>

30
Output:

31
Result: - Students design an android application using frame layout.

Conclusion: Thus, students understood how to demonstrate an android application


Using frame layout

32
9. Developing an android application using Relative layout to
display Date and time.

Aim:- Developing an android application using Relative layout to display


Date and time.

Objective: Student should be able to design android application using relative


layout to display Date and time.

Outcome: Student will demonstrate the android application using relative layout
to displayDate and time.

Software:

1. Microsoft Windows (07 or later)


2. The Android SDK (Starter Package)
3. Java Development Kit (JDK) 5 or 6.
4. Eclipse

Theory:

Relative Layout is a view group that displays child views in relative positions.

Code:

1. MainActivity.Java

package com.example.relativeapp;

import java.text.SimpleDateFormat;
import
java.util.Date;
import
android.os.Bu
33
ndle; import
android.app.A
ctivity;
import
android.view.M
enu;
import android.widget.TextView;

public class MainActivity

extends Activity { @Override


protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

Date date = new Date();


String nowDate = dateFormat.format(date);
TextView dateView = (TextView)findViewById(R.id.dates);
dateView.setText(nowDate);

SimpleDateFormat timeFormat= new SimpleDateFormat("HH:mm:ss"); String


nowTime = timeFormat.format(date);

TextView timeView = (TextView)findViewById(R.id.times);


timeView.setText(nowTime);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

34
1. res/layout/activity_main.xml

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:paddingLeft="
16dp"
android:paddingRight=
"16dp"

>

<EditText android:id = "@+id/name"


android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint = "@string/reminder" />

<TextView
android:id = "@+id/dates" android:layout_width="96dp"
android:layout_height="wrap_content"

android:layout_below="@id/name"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/times"
/>

<TextView android:id="@+id/times"

android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:layout_alignParentRight="true
" />

<Button
android:layout_width
35
="96dp"
android:layout_height="wrap_content"
android:layout_below="@+id/dates"
android:layout_toLeftOf="@+id/times"
android:text="@string/done" />

</RelativeLayout>

1. res/values/strings.xml

<?xml version="1.0" encoding="utf-8"?>


<resources>

<string name="app_name">relativeapp</string>
<string name="action_settings">Settings</string>
<string name="reminder">Enter your name</string>
<string name = "done">Done</string>

</resources>
Output:

36
Result: - Students design an android application using relative layout to display Date &
Time.

Conclusion: Thus, students understood how to demonstrate an android


application using relative layout to display Date & Time.

37
38

You might also like