You are on page 1of 8

EXPERIMENT NO: 01

AIM: Introduction to Android Operating System.


OBJECTIVE: To get the knowledge of android operating system background. OUTCOME: Aware of the
android operating system.

SOFTWARE:
1. Windows 10
2. The Android SDK (Starter Package)
3. Java Development Kit(JDK)5

THEORY:
Android Architecture
Android operating system is a stack of software components which is roughly divided into five sections and
four main layers as shown below in the architecture diagram.

The Android architecture has the following layers:


1. Linux Kernel: This is the foundation of the Android operating system and provides the basic system
services such as process management, memory management, and device management.
2. Libraries: This layer consists of a set of libraries that support the functionality of the Android system. This
includes libraries such as the WebKit engine, SQLite database, audio and video libraries, and SSL libraries.

HET ANAND DAVE 1 ROLL NO-05


3. Android Runtime: The Android runtime provides the Dalvik Virtual Machine (DVM) and a set of core
libraries. The DVM is a specialized Java Virtual Machine optimized for Android, and the core libraries allow
developers to write Android applications using the Java programming language.
4. Application Framework: This layer provides a set of services and APIs for developers to build their
applications. The services and APIs are provided in the form of Java classes, which can be accessed and used
by applications.
5. Applications: This is the top layer where all Android applications reside. This layer includes applications
such as the contacts book, browser, games, and more.
6. Android UI: This is the user interface of Android applications, including the visual components such as
buttons, text fields, and layouts, as well as the behavior and interactions with the user. The UI is responsible
for providing a user-friendly experience and allowing the user to interact with the application.
You define your layout in an XML file which offers a human-readable structure for the layout, similar to
HTML. For example, a simple vertical layout with a text view and a button looks like this:
<?xml version="1.0"encoding="utf-8"?>
<Linear Layout
xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"
android:layout_height="fill_parent"android:orientation="vertical" >
<TextView
android:id="@+id/text"
android:layout_width="wrap
_
content"android:layout_heigh
t
="wrap
_content"android:text="I am a Text View"/>
<Buttonandroid:id="@+id/button"android:layout_width="wrap_content" android:
layout_height="wrap_content"android: text="I am a Button"/>/LinearLayout>
Android UI Controls:
There are number of UI controls provided by Android that allow you to build the graphical userinterface for
your app.

Sr.N UI Control &Description


o.

HET ANAND DAVE 2 ROLL NO-05


1 Text View
This control is used to display text to the user.

2 Edit Text
EditTextisapredefinedsubclassofTextViewthatincludesricheditingcapabilities.

3 Auto Complete Text View


The Auto Complete Text View is a view that is similar to Edit Text except that it’s
how’s a list of completion suggestions automatically while the user is typing.

4 Button
A push-button that can be pressed, or clicked, by the user to performance action.

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

6 Check Box
An on/off switch that can be toggled by the user. You should use check boxes when
presenting users with a group of select able options that are not mutually exclusive.

7 Toggle Button
An on/off button with a light indicator.

8 Radio Button
The Radio Button has two states: either checked or unchecked.

9 Radio Group
A Radio Group is used to group together

HET ANAND DAVE 3 ROLL NO-05


10 Progress Bar
The Progress Bar view provides visual feedback about some ongoing tasks, such as
whenua e performing a task in the background.

11 Spinner
A drop-down list that allows users to select one value from a set.

12 Time Picker
The Time Picker view enables users to select a time of the day, in either24-
hourmode or AM/PM mode.

13 Date Picker
The Date Picker view enables users to select a date of the day.

Create UI Controls
As explained in previous chapter, a view object may have a unique ID assigned to it which will identify the
View uniquely within the tree. The syntax for an ID, inside an XML tag is:
android:id="@+id/text_id"
To create a UI Control/View/Widget you will have to define a view/widget in the layout file and assign it a
unique ID as follows:
<?xmlversion="1.0"encoding="utf-8"?>

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_wi dth="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/text_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"android:text="Ia ma
HET ANAND DAVE 4 ROLL NO-05
TextView"/>
</LinearLayout>
Then finally create an instance of the Control object and capture it from the layout, use the following:
TextViewmyText= (TextView) find ViewById(R.id.text_id);
Android Event Handling
Events are a useful way to collect data about a user's interaction with interactive components of your app, like
button presses or screen touch etc. The Android framework maintains an event queue into which events are
placed as they occur and then each event is removed from the queue on a first-in, first- out (FIFO) basis. You
can capture the seventh in your program and take appropriate action as per requirements.
There are following three concepts related to Android Event Management:
• Event Listeners: The View class is mainly involved in building up Android GUI, same View class provides
number of Event Listeners. The Event Listeners is the object that receives notification when an event happens.
• Event Listeners Registration: Event Registration is the process by which an Event Handler gets registered
with an Event Listener so that the handler is called when the Event Listener fires the event.
• Event Handlers: When an event happens and we have registered and event listener for the event, the event
listener calls the Event Handlers, which is the method that actually handles the event.
Event Listeners & Event Handlers

EventHandler EventListener&Description

onClick() onClickListener()
This is called when the user either click sort ouches or focuses upon
any widget like button, text, image etc. You will use on Click ()
event handler to handle such event.

onLongClick() onLongClickListener()
This is called when the user either clicks or touches or focuses upon
any widget like button, text, image etc. for one or more seconds.
You will use onLongClick()event handler to handle such event.

onFocusChange() onFocusChangeListener()
This is called when the widget loses its focus i.e.user go away from
the view item. You will use onFocusChange()event handler to
handle such event.

HET ANAND DAVE 5 ROLL NO-05


onKey() This is called when the user is focused on the item and presses or
releases key on the device. You will use on Key () event handler to
handle such event.

onTouch() onTouchListener()
This is called when the user presses the key, releases the key, or
anymovement gesture on the screen. You will use on Touch()
eventhandler to handle such event.

onMenuItemClick() onMenuItemClickListener()
This is called when the user selects a menu item. You will use
onMenuItem Click () event handler to handle such event.

There are many more event listeners available as a part of View class like OnHoverListener, OnDragListener
etc. which may be needed for your application. So I recommend to refer official documentation for Android
application development in case you are going to developa sophisticated apps.
To install Android Studio, you can follow these steps:
1. Download Android Studio: Go to the Android Studio website (https://developer.android.com/studio) and

download the latest version of Android Studio for your operating system.

HET ANAND DAVE 6 ROLL NO-05


2. Install Android Studio: Double-click the downloaded file to start the installation process. Follow the on-
screen instructions to install Android Studio on your system.

3. Launch Android Studio: After the installation process is complete, launch Android Studio from your
applications menu or the desktop shortcut.

4. Configure Android Studio: The first time you launch Android Studio, you will be
prompted to configure it. Choose the “Custom” setup type and select the components you
want to install.

HET ANAND DAVE 7 ROLL NO-05


5. Install Required Components: If you selected the “Custom” setup type, you will be prompted to install
required components such as the Android SDK, the Android emulator, and the latest version of the Android
operating system.
6. Start a New Project: Once you have completed the installation process, you can start a new project by
clicking on the “Start a new Android Studio project” button.

RESULT: We have installed Android Studio successfully.


CONCLUSION: Thus, students understood the History Versions, Architecture, IDE(Eclipse), SDK of
android.

HET ANAND DAVE 8 ROLL NO-05

You might also like