0% found this document useful (0 votes)
33 views6 pages

Note Taking

Uploaded by

Nishant Kulkarni
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)
33 views6 pages

Note Taking

Uploaded by

Nishant Kulkarni
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/ 6

Nishant Kulkarni

Roll no. 03

ANDROID PROGRAMMING ASSIGNMENT

Q1. Describe Android Architecture with the help of diagram.


->. Android architecture contains di erent number of components to support any android
device needs. Android software contains an open-source Linux Kernel having collection of
number of C/C++ libraries which are exposed through an application framework services.

Among all the components Linux Kernel provides main functionality of operating system
functions to smartphones and Dalvik Virtual Machine (DVM) provide platform for running an
android application.
The main components of android architecture are following:-
Applications, Application Framework, Android Runtime, Platform Libraries and Linux Kernel.

Applications –
Applications is the top layer of android architecture. The pre-installed applications like
home, contacts, camera, gallery etc and third party applications downloaded from the play
store like chat applications, games etc. will be installed on this layer only.
It runs within the Android run time with the help of the classes and services provided by the
application framework.

Application framework –
Application Framework provides several important classes which are used to create an
Android application. It provides a generic abstraction for hardware access and also helps in
managing the user interface with application resources. Generally, it provides the services
with the help of which we can create a particular class and make that class helpful for the
Applications creation.
It includes di erent types of services activity manager, noti cation manager, view system,
package manager etc. which are helpful for the development of our application according
to the prerequisite.

Application runtime –
Android Runtime environment is one of the most important part of Android. It contains
components like core libraries and the Dalvik virtual machine(DVM). Mainly, it provides the
base for the application framework and powers our application with the help of the core
libraries.
Like Java Virtual Machine (JVM), Dalvik Virtual Machine (DVM) is a register-based virtual
machine and specially designed and optimised for android to ensure that a device can run
multiple instances e ciently. It depends on the layer Linux kernel for threading and low-
level memory management. The core libraries enable us to implement android applications
using the standard JAVA or Kotlin programming languages.

Platform libraries –
The Platform Libraries includes various C/C++ core libraries and Java based libraries such
as Media, Graphics, Surface Manager, OpenGL etc. to provide a support for android
development.

Media library provides support to play and record an audio and video formats.

Surface manager responsible for managing access to the display subsystem.


ff
ffi
ff
fi
SGL and OpenGL both cross-language, cross-platform application program interface (API)
are used for 2D and 3D computer graphics.

SQLite provides database support and FreeType provides font support.

Web-Kit This open source web browser engine provides all the functionality to display web
content and to simplify page loading.

SSL (Secure Sockets Layer) is security technology to establish an encrypted link between a
web server and a web browser.

Linux Kernel –
Linux Kernel is heart of the android architecture. It manages all the available drivers such as
display drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which
are required during the runtime.
The Linux Kernel will provide an abstraction layer between the device hardware and the
other components of android architecture. It is responsible for management of memory,
power, devices etc.
The features of Linux kernel are:

Security: The Linux kernel handles the security between the application and the system.

Memory Management: It e ciently handles the memory management thereby providing the
freedom to develop our apps.

Process Management: It manages the process well, allocates resources to processes


whenever they need them.

Network Stack: It e ectively handles the network communication.

Driver Model: It ensures that the application works properly on the device and hardware
manufacturers responsible for building their drivers into the Linux build.

Q2. Explain Basic building blocks of Android application.


-> The fundamental building blocks of Android are Activities, Services, Broadcast Receivers
and Content Providers. Interchange in data between these blocks is handled by Intents
which can be either Explicit or Implicit intents.

There are following four main components that can be used within an Android application.

Activities: It Control the UI and handle the user interaction to the Android App screen, it
represents a single screen with a user interface.Activity performs actions on the screen, For
example, Medium application might have one activity that shows a list of articles while
another activity to read the Noti cations and another activity for viewing user pro le.

Services: The Service is another building block of Android applications. They handle
background running tasks associated with an application. It is a program that can run in the
background for an in nite period and it does not provide a UI. A good example of service is
the music player app, let us consider Google play Music which keep on playing music while
the main android app activity is destroyed or closed.

Broadcast Receivers: They handle communication between core Android OS and


applications running on the surface layer. The application modules communicate with each
other using the broadcast receiver. Messages can be initiated by the system or the app. For
example, if a user is using your app and a phone call comes in, the Broadcast Receiver
interface will notify your app.
ff
fi
ffi
fi
fi
Content Providers: They handle data interchange and database related components. This
provides a uniform singular interface to the content & data. The content can be from your
app being exposed to the system or other apps or it could be system content for example,
pictures on your phone, contact lists, or les in the le system. It provides a consistent
interface to retrieve/store data via external data sources or databases.

Q3. Write Short note on:


1) SDK
2) AVD
-> 1) SDK: Android SDK stands for Android Software Development Kit which is developed
by Google for Android Platform. With the help of Android SDK, we can create android Apps
easily.
Android SDK is a collection of libraries and Software Development tools that are essential
for Developing Android Applications. Whenever Google releases a new version or update of
Android Software, a corresponding SDK also releases with it. In the updated or new version
of SDK, some more features are included which are not present in the previous version.
Android SDK consists of some tools which are very essential for the development of
Android Application. These tools provide a smooth ow of the development process from
developing and debugging. Android SDK is compatible with all operating systems such as
Windows, Linux, macOS, etc.

2) AVD: Android Virtual Device(AVD) is a software representation of an actual world physical


android device. In other words, it doesn’t have any physical existence but behaves like a
physical android device itself. It has everything which you think a physical machine would
have. Whether it’s storage, audio, noti cations, applications, etc., all are present in the
android virtual device. Most of the android virtual devices are self-con gurable. In other
words, you can con gure the hardware and the version of android which you wish to
operate on.

Q4. Explain Android Activity Life Cycle with functions/Program.


-> Android Activity Life Cycle is controlled by 7 methods of android.app.Activity class. The
android Activity is the subclass of ContextThemeWrapper class. An activity is the single
screen in android. It is like window or frame of Java.
The 7 lifecycle method of Activity describes how activity will behave at di erent states.
1. onCreate: called when activity is rst created.
2. onStart: called when activity is becoming visible to the user.
3. onResume: called when activity will start interacting with the user.
4. onPause: called when activity is not visible to the user.
5. onStop: called when activity is no longer visible to the user.
6. onRestart: called after activity is stopped, prior to start.
7. onDestroy: called before the activity is destroyed.

Android Activity Lifecycle Example:


<?xml version=“1.0” encoding=“utf-8”?>
<android.support.constraint.ConstraintLayout xmlns:android=“https://
schemas.android.com/apk/res/android”
xmlns:app=“http://schemas.android.com/apk/res-auto”
xmlns:tools=“http://schemas.android.com/tools”
tools:context=“example.javapoint.com.activitylifecyle.MainActivity”>
<TextView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:text=“Hello world!”
app:layout_constraintBottom_toBottomOf=“parent”
app:layout_constraintLeft_toLeftOf=“parent”
app:layout_constraintRight_toRightOf=“parent”
app:layout_constraintTop_toTopOf=“parent”/>
fi
fi
fi
fi
fi
fl
fi
ff
</android.support.constraint.ConstraintLayout>

Q5. What is Intent?Explain Implicit Intent and Explicit Intent?(Write Syntax/Example)


-> An intent is to perform an action on the screen. It is mostly used to start activity, send
broadcast receiver, start services and send message between two activities. There are two
intents available in android as Implicit Intents and Explicit Intents. Here is a sample example
to start new activity with old activity.

Implicit Intent speci es an action that can be invoked by any app on the device which
enables us to perform an action. It does not have exact knowledge about the landing
component. It can open another app or its own app’s component and many other options
exist. Examples: Downloaded song, PDF, image, document, dial call, map location, etc.

Syntax of open Google map:-

Intent intent = new Intent(Intent.ACTION_VIEW)


intent.set Data(Uri.parse(“http://www.google.com”));
startActivity(intent);

Explicit Intent speci es the component in an app. It is one that we use to launch a speci c
app component, such as a particular activity or service in our application. Using this intent
we can pass the data from one activity to another activity.
Examples: startActivity (know about which activity will start), start service to download the
le.

Syntax of explicit intent:-

Intent explicit_intent = new Intent(MainActivity.this, Explicit_intent.class);


startActivity(explicit_intent);

Q6. List Types of Layouts. Explain Table Layout & Grid Layout in detail.
-> A layout de nes the structure for a user interface in your app, such as in an activity. All
elements in the layout are built using a hierarchy of view and viewGroup objects. A view
usually draws something the user can see and interact with. Whereas a viewGroup is an
invisible container that de nes the layout structure for view and other viewGroup objects.

The following are types of Layouts:


Linear Layout, Relative Layout, Table Layout, Absolute Layout, Frame Layout, List Layout/
view, Grid Layout/ view.

Linear Layout: Linear Layout is a view group that aligns all children in a single direction,
vertically or horizontally.

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

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

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

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

List View/Layout: It is a view group that displays a list of scrollable items.

Grid View/Layout: It is a view group that displays items in a two-dimensional, scrollable


grid.
fi
fi
fi
fi
fi
fi
Table Layout is a view that groups views into rows and columns. TableLayout containers do
not display border lines for their rows, columns, or cells.

Grid View/Layout is a view group that displays items in a two-dimensional, scrollable grid
i.e., (rows and columns)

Q7. Explain view, view group and layouts: Linear Layout, Constraint Layout and Frame
Layout in detail.
-> View:- A View is a simple building block of a user interface. It is a small rectangular box
that can be TextView, EditText, or even a button. It occupies the area on the screen in a
rectangular area and is responsible for drawing and event handling.

ViewGroup:- A View Group is a subclass of the ViewClass and can be considered as a


superclass of Layouts. It provides an invisible container to hold the views or layouts.
ViewGroup instances and views work together as a container for Layouts.

Layout:- Layout basically refers to the arrangement of elements on a page these elements
are likely to be images, texts or styles. They de ne the structure of android user interface in
the app, like in an activity. All elements in the layout are built with the help of Views and
ViewGroups.

Linear Layout:- This layout is used to place the elements in a linear manner. A Linear
manner means one element per line. This layout creates various kinds of forms on Android.
In this, arrangement of the elements is in a top to bottom manner.
Linear layout can have two orientations:- Vertical Orientation and Horizontal Orientation.
Vertical Orientation:- It is shown above where the widgets such as TextViews, and all in a
vertical manner.
Horizontal Orientation:- It is shown above where the widgets such as TextViews, and all in a
horizontal manner.

Constraint Layout:- Constraint Layout is a ViewGroup (i.e. a view that holds other views)
which allows to create large and complex layouts with a at view hierarchy, and also allows
to position and size widgets in a very exible way. ConstraintLayout is very similar to
RelativeLayout because, views are laid out according to relationships between sibling views
and the parent layout.

Frame Layout:- Frame Layout is one of the simplest layout to organise view controls. They
are designed to block an area on the screen. Frame Layout is used to hold child view,
because it can be di cult to display single views at a speci c area on the screen without
overlapping each other.
ffi
fl
fi
fl
fi

You might also like