Professional Documents
Culture Documents
Unit-I Question Set
Unit-I Question Set
S
COCSIT LATUR
Unit-I
Android is an open source, Linux-based software stack created for a wide array of devices and
form factors. The following diagram shows the major components of the Android platform.
The Android architecture basically categories in following ways.
1. Power management
2. Linux kernel
Using a Linux kernel allows Android to take advantage of key security features and allows device
manufacturers to develop hardware drivers for a well-known kernel.
5. Native Library
Many core Android system components and services, such as ART and HAL, are built from
native code that require native libraries written in C and C++.
The Android platform provides Java framework APIs to expose the functionality of some of these
native libraries to apps. For example, you can access OpenGL ES through the Android
framework’s Java OpenGL API to add support for drawing and manipulating 2D and 3D graphics
in your app.
6. Java API Framework
The entire feature-set of the Android OS is available to you through APIs written in the Java
language. These APIs form the building blocks you need to create Android apps by simplifying
the reuse of core, modular system components and services
7. System Application
Android comes with a set of core apps for email, SMS messaging, calendars, internet browsing,
contacts, and more
G.P.S
COCSIT LATUR
Application components are the essential building blocks of an Android application. These
components are loosely coupled by the application manifest file AndroidManifest.xml that
describes each component of the application and how they interact.
There are following four main components that can be used within an Android application
1] Activities
An activity represents a single screen with a user interface, in-short Activity performs actions on
the screen. For example, an email application might have one activity that shows a list of new
emails, another activity to compose an email, and another activity for reading emails. If an
application has more than one activity, then one of them should be marked as the activity that is
presented when the application is launched.
2] Services
A service is a component that runs in the background to perform long-running operations. For
example, a service might play music in the background while the user is in a different application,
or it might fetch data over the network without blocking user interaction with an activity.
A service is implemented as a subclass of Service class as follows –
public class MyService extends Service {
}
3] Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or from the
system. For example, applications can also initiate broadcasts to let other applications know that
some data has been downloaded to the device and is available for them to use, so this is broadcast
receiver who will intercept this communication and will initiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiver class and each message
is broadcaster as an Intent object.
4] Content Providers
A content provider component supplies data from one application to others on request. Such
requests are handled by the methods of the Content Resolver class. The data may be stored in the
file system, the database or somewhere else entirely.
A content provider is implemented as a subclass of Content Provider class and must implement
a standard set of APIs that enable other applications to perform transactions.
The Dalvik Virtual Machine (DVM) is an android virtual machine optimized for mobile
devices. It optimizes the virtual machine for memory, battery life and performance.
Dalvik is a name of a town in Iceland.
The Dalvik VM was written by Dan Bornstein.
The Dex compiler converts the class files into the .dex file that run on the Dalvik VM. Multiple
class files are converted into one dex file.
The javac tool compiles the java source file into the class file.
The dx tool takes all the class files of your application and generates a single .dex file. It is a
platform-specific tool.
The Android Assets Packaging Tool (aapt) handles the packaging process.
Advantages
DVM supports the Android operating system only.
In DVM executable is APK.
Execution is faster.
Disadvantages
DVM supports only Android Operating System.
For DVM very few Re-Tools are available.
App Installation takes more time due to dex.
G.P.S
COCSIT LATUR
1. AndroidManifest.xml: This file includes nodes for each of the Activities, Services, Content
Providers and Broadcast Receiver that make the application and using Intent Filters and
Permissions, determines how they co-ordinate with each other and other applications.
2. Java: The Java folder contains the Java source code files. These files are used as a controller
for controlled UI (Layout file). It gets the data from the Layout file and after processing that data
output will be shown in the UI layout. It works on the backend of an Android application.
3. drawable: A Drawable folder contains resource type file (something that can be drawn).
Drawables may take a variety of file like Bitmap (PNG, JPEG), Nine Patch, Vector (XML),
Shape, Layers, States, Levels, and Scale.
4. Layout: A layout defines the visual structure for a user interface, such as the UI for an Android
application. This folder stores Layout files that are written in XML language. You can add
additional layout objects or widgets as child elements to gradually build a View hierarchy that
defines your layout file
5. mipmap: Mipmap folder contains the Image Asset file that can be used in Android Studio
application. You can generate the following icon types like Launcher icons, Action bar and tab
icons, and Notification icons.
6. colors.xml: colors.xml file contains color resources of the Android application. Different color
values are identified by a unique name that can be used in the Android application program.
7. strings.xml: The strings.xml file contains string resources of the Android application. The
different string value is identified by a unique name that can be used in the Android application
program. This file also stores string array by using XML language.
G.P.S
COCSIT LATUR
It is responsible to protect the application to access any protected parts by providing the
permissions.
1. <manifest>
manifest is the root element of the AndroidManifest.xml file. It has package attribute that
describes the package name of the activity class.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.hello"
</manifest>
2. <application>
application is the subelement of the manifest. It includes the namespace declaration. This
element contains several subelements that declares the application component such as activity etc.
The commonly used attributes are of this element are icon, label, theme etc.
android:icon represents the icon for all the android application components.
android:label works as the default label for all the application components.
android:theme represents a common theme for all the android activities.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
</application>
3. <activity>
activity is the subelement of application and represents an activity that must be defined in the
AndroidManifest.xml file. It has many attributes such as label, name, theme, launchMode etc.
android:label represents a label i.e. displayed on the screen.
android:name represents a name for the activity class. It is required attribute.
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
</activity>
4. <intent-filter>
intent-filter is the sub-element of activity that describes the type of intent to which activity,
service or broadcast receiver can respond to.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>