0% found this document useful (0 votes)
8 views13 pages

Exam Solution

Android is an open-source operating system that manages device resources and serves as a platform for applications. It allows developers to create customized versions and applications for various devices, making it the most popular mobile OS. The document also outlines the Android architecture, features, and various components such as the application framework, runtime, and libraries.

Uploaded by

sstories569
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)
8 views13 pages

Exam Solution

Android is an open-source operating system that manages device resources and serves as a platform for applications. It allows developers to create customized versions and applications for various devices, making it the most popular mobile OS. The document also outlines the Android architecture, features, and various components such as the application framework, runtime, and libraries.

Uploaded by

sstories569
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/ 13

1. A)Android is an OS,an open source and a platform explain why?

Android is an operating system (OS) because it is the software that controls the
hardware and software of a device. It is responsible for managing the device's
resources, such as memory, CPU, and storage, and for providing a platform for
applications to run.

Android is also an open source operating system. This means that the source code
for Android is freely available to anyone to view, modify, and redistribute. This
allows developers to create their own custom versions of Android for different
devices and purposes.

Finally, Android is a platform. This means that it is a foundation upon which other
software can be built. For example, developers can create applications that run on
Android devices. These applications can be anything from games to productivity
tools to social media apps.

Here are some specific reasons why Android is an OS, an open source, and a
platform:

 Android is an OS: Android is a collection of software that controls the


hardware and software of a device. It manages the device's resources, such
as memory, CPU, and storage, and provides a platform for applications to
run.
 Android is open source: The source code for Android is freely available to
anyone to view, modify, and redistribute. This allows developers to create
their own custom versions of Android for different devices and purposes.
 Android is a platform: Android is a foundation upon which other software
can be built. For example, developers can create applications that run on
Android devices. These applications can be anything from games to
productivity tools to social media apps.

The fact that Android is an open source OS and a platform has made it a very
popular choice for mobile devices. It allows manufacturers to create devices that
are customized to their specific needs and allows developers to create applications
that can run on a wide range of devices. This has helped to make Android the most
popular mobile operating system in the world.
1.b) Draw the android App/Project Folder structure

1.C) Make a list of android vererson names,code name with their API levels

Version Release Date Code Name API Level

1.0 23 Sep, 2008 Alpha/Apple Pie/NA 1

1.1 9 Feb, 2009 Banana Bread/NA 2

1.5 30 Apr, 2009 Cupcake 3

1.6 15 Sep, 2009 Donut 4

2.0/2.1 26 Oct, 2009 Éclair 5-7

2.2 20 May, 2010 Froyo 8

2.3 6 Dec, 2010 Gingerbread 9-10

3.0/3.1/3.2 22 Feb, 2011 Honeycomb 11-13

4.0 18 Oct, 2011 Ice Cream Sandwich 14-15


4.1/4.2/4.3 9 Jul, 2012 Jelly Bean 16-18

4.4 31 Oct, 2013 KitKat 19-20

5.0/5.1 12 Nov, 2014 Lollipop 21-22

6.0 5 Oct, 2015 Marshmallow 23

7.0 2016 End Nougat 24

8.0 21 Aug, 2017 Oreo 26

9.0 6 Aug, 2018 Pie 28

10 23 Sept, 2019 Android 10 29

11 08 Sept, 2020 Android 11 30

2.A) Graphical explain the android features

2(b) How many layers are in android Architecture? Explain in the role and features
of each layers?
1. Applications
2. Android Framework
3. Android Runtime
4. Platform Libraries
5. Linux Kernel

In these components Linux Kernel is the main component in android to provide its operating system functions
to mobile and Dalvik Virutal Machine (DVM) which is responsible for running a mobile application.

Applications

The top layer of android architecture is Applications. The native and third party applications like contacts, email,
music, gallery, clock, games, etc. whatever we will built those will be installed on this layer only.

The application layer runs within the Android run time using the classes and services made available from the
application framework.

Application Framework

The Application Framework provides the classes used to create an Android applications. It also provides a
generic abstraction for hardware access and manages the user interface and application resources.
The application framework includes services like telephony service, location services, notification manager,
NFC service, view system, etc. which we can use for application development as per our requirements.
Android Runtime

Android Runtime environment is an important part of Android rather than an internal part and it contains a
components like core libraries and the Dalvik virtual machine. The Android run time is the engine that powers
our applications along with the libraries and it forms the basis for the application framework.

Dalvik Virtual Machine (DVM) is a register-based virtual machine like Java Virtual Machine (JVM). It is
specially designed and optimized for android to ensure that a device can run multiple instances efficiently. It
relies on the Linux kernel for threading and low-level memory management.

Platform Libraries

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

 Media library for playing and recording an audio and video formats
 The Surface manager library to provide a display management
 SGL and OpenGL Graphics libraries for 2D and 3D graphics
 SQLite is for database support and FreeType for font support
 Web-Kit for web browser support and SSL for Internet security.

Linux Kernel

Linux Kernel is a bottom layer and heart of the android architecture. It manage all the drivers such as display
drivers, camera drivers, Bluetooth drivers, audio drivers, memory drivers, etc. which are mainly required for the
android device during the runtime.

The Linux Kernel will provides an abstraction layer between the device hardware and the remainder of the stack.
It is responsible for memory management, power management, device management, resource access, etc.

2(C) Explainthe following tterms


v.TextView: Attributes of TextView:
Now lets we discuss about the attributes that helps us to configure a TextView in
your xml file.
1. id: id is an attribute used to uniquely identify a text view. Below is the example
code in which we set the id of a text view.

2. gravity: The gravity attribute is an optional attribute which is used to control the
alignment of the text like left, right, center, top, bottom, center_vertical,
center_horizontal etc.
3. text: text attribute is used to set the text in a text view. We can set the text
in xml as well as in the java class.

4. textColor: textColor attribute is used to set the text color of a text view. Color
value is in the form of “#argb”, “#rgb”, “#rrggbb”, or “#aarrggbb”.

5. textSize: textSize attribute is used to set the size of text of a text view. We can
set the text size in sp(scale independent pixel) or dp(density pixel).

6. textStyle: textStyle attribute is used to set the text style of a text view. The
possible text styles are bold, italic and normal. If we need to use two or more
styles for a text view then “|”

7. background: background attribute is used to set the background of a text view.


We can set a color or a drawable in the background of a text view.

8. padding: padding attribute is used to set the padding from left, right, top or
bottom. In above example code of background we also set the 10dp padding from
all the side’s of text view.

vi) Orientation: The screenOrientation is the attribute of activity element. The


orientation of android activity can be portrait, landscape, sensor, unspecified etc.
You need to define it in the AndroidManifest.xml file.
In Android code, orientation refers to the orientation of the device screen. The
possible
orientations are:
 Portrait: The device screen is in portrait orientation, with the longer dimension
vertical.
 Landscape: The device screen is in landscape orientation, with the longer
dimension horizontal.
 Unspecified: The device screen orientation is unspecified. This is the default
orientation for Android apps.
 Sensor: The device screen orientation is determined by the device's sensor. This
orientation is typically used for games and other apps that need to be responsive
to the device's orientation.

vii) Java Developemen Kidt(JDK): The Java Development Kit (JDK) is a software
development kit (SDK) that contains the tools and libraries you need to develop Java
applications. It includes the Java Runtime Environment (JRE), the Java Virtual
Machine (JVM), and a collection of development tools, such as the Java compiler
and debugger.

vii)Integrated Development Environment (IDE) :An Integrated Development


Environment (IDE) is a software application that provides comprehensive facilities
to computer programmers for software development. An IDE normally consists of
at least a source-code editor, build automation tools, and a debugger. Some IDEs,
such as NetBeans and Eclipse, contain the necessary compiler, interpreter, or both;
others, such as SharpDevelop and Lazarus, do not.

3(a) differentiate of the following


vi) JDK vs IDES

Feature JDK IDE


Provides a comprehensive environment
Provides the tools and libraries for developing software, including
you need to develop Java features such as a code editor, debugger,
Purpose applications. and build automation tools.
Includes the Java Runtime Does not include the JRE or JVM, but
Environment (JRE), the Java may include other components such as a
Virtual Machine (JVM), and a code editor, debugger, and build
Components collection of development tools. automation tools.
Used by Java developers to Used by software developers to develop
Use cases develop Java applications. software in a variety of languages.
vii) Gradle and Bundle
Feature Gradle Bundle

A general-purpose build A build system specifically designed


Purpose automation system. for Android apps.

Very flexible and can be used More lightweight and specifically


to automate a wide range of designed to optimize app size and
Flexibility tasks. performance.

Widely supported by the Less widely supported than Gradle,


Support Android community. but still supported by Google.

Learning Gradle has a steeper learning Bundle has a shallower learning


curve curve than Bundle. curve than Gradle.

viii) Margin vs Padding

Margin Padding

margin means to push outside padding means to push inside.

Margin is used to create extra space Padding is used to create extra space
between two views. around the content of a view.

Margin affects layout outside the Padding affects the layout inside the
border of a view. border of a view.
vii) Linear and relative layout
Feature Linear layout Relative layout

Arranges children in a single


direction, either horizontally or
Direction vertically. Arranges children relative to each other.

Flexibility Less flexible than relative layout. More flexible than linear layout.

Used for simple layouts where Used for more complex layouts where
the children need to be arranged the children need to be arranged in a
Use cases in a single direction. variety of ways.

viii) Wrap_content and Match_parent

1. match_parent is used for referring to the parent size either through


layout_width or layout_height attributes. If we set layout_height as
match_parent then the view’s height will be as same as the parent’s
height. The parent is the outer layout in which the view is present. If we
set layout_width as match parent the view’s width will be as same as the
parent’s width.fill_parent -The component want to display as big as its
parent, and fill in the remaining spaces.
wrap_content is used to wrap the view according to its actual size. It can be used
with layout_height as well as layout_width. If we set layout_height as
wrap_content then the height will be the same as the content size and if we set
layout_width as wrap_content then the width will be the same as the content size.
The size will be defined on the basis of content size, if the image size is small
then the view will wrap only that image according to its size.

3.B)
Why this line: xmlns:android=“http://schemas.android.com/apk/res/android”? In
XML, element
In XML, element names are defined by the developer. This often results in a conflict when trying to
mix XML documents from different XML applications. A user or an XML application will not know
how to handle these differences. Name conflicts in XML can easily be avoided using a name prefix.
When using prefixes in XML, a namespace for the prefix must be defined. Thus, this Name Space
declaration must be included in the opening tag of the root view of our XML file.

The namespace declaration has the following syntax. xmlns:prefix="URI".

In computing, a uniform resource identifier (URI) is a string of characters used to identify a name of a
resource. Such identification enables interaction with representations of the resource over a network,
typically the World Wide Web, using specific protocols.

In Android, this is just the XML Name Space declaration. We use this Name Space in order to specify
that the attributes belongs to Android. Thus they starts with "android:". We can actually create our
own custom attributes. So to prevent the name conflicts where 2 attributes are named the same thing,
but behave differently, we add the prefix "android:" to signify that these are Android attributes.

Meaning of -<?xml version=’1.0’ encoding=’utf-8”?>

Encoding is the process of converting unicode characters into their equivalent binary

representation. When the XML processor reads an XML document, it encodes the document

depending on the type of encoding. Hence, we need to specify the type of encoding in the XML

declaration. A character in UTF8 can be from 1 to 4 bytes long. UTF-8 can represent any
character in the Unicode standard. UTF-8 is backwards compatible with ASCII. UTF-8 is the

preferred encoding for e-mail and web pages

What is for activity main.xml file?


The UI of our application will be designed in this file and it will contain Design and Text modes. It will exist
in layouts folder and the structure of activity_main.xml file in Design mode like as shown below.

We can make a required design modifications in activity_main.xml file either using Design
or Text modes. If we switch to Text mode activity_main.xml file will contain a code like as shown below.

Android Manifest File (AndroidManifest.xml)

Generally our application will contain multiple activities and we need define all
those activities in AndroidManifest.xml file. In our manifest file we need to mention the main activity for our
app using MAIN action and LAUNCHER category attributes in intent filters (<intent-filter>).
Following is the default code of AndroidManifest.xml file which is generated by our HelloWorld application.

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


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sarker.helloworld" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

android:textColor="#0832ca" is an XML attribute that sets the text color of a view in


an Android app. The value #0832ca is a hexadecimal color code that represents a dark
blue color.

android:textSize="30sp" is an XML attribute that sets the text size of a view in an


Android app. The value 30sp represents 30 scaled pixels.
4.a) OHA (Open Handset Alliance)

The Open Handset Alliance (OHA) is a business alliance that was created for the purpose of
developing open mobile device standards. The OHA has approximately 86 (2017)/84 (2020)
member companies, including HTC, Dell, Intel, Motorola, Qualcomm and Google. The OHA's main
product is the Android platform - the world's most popular smartphone platform.

You might also like