Exam Solution
Exam Solution
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:
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
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. 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 “|”
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.
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.
Margin Padding
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
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.
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.
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.
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
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.
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.
<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>
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.