Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

G.P.

S
COCSIT LATUR

Royal Education Society’s


College of Computer Science and Information Technology, Latur

Department of Computer Science


Academic Year (2021-22)
Choice Based Credit System (CBCS Pattern)

Class/Semester: BCA TY-V Name of Paper: Mobile Application Development

Unit-I

Q.1] Explain to Android platform and Architecture?

Q.2] Explain Basic Component of Android?

Q.3] Write a note on Activity Lifecycle?

Q.4] Write a note on DVM?

Q.5] Explain Android Application Structure?

Q.6] Write a note on Android Manifest.xml?


G.P.S
COCSIT LATUR

Q.1] Explain to Android platform and Architecture?

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.

3. Hardware Abstraction Layer.


The hardware abstraction layer (HAL) provides standard interfaces that expose device hardware
capabilities to the higher-level Java API framework. The HAL consists of multiple library
modules, each of which implements an interface for a specific type of hardware component, such
as the camera or Bluetooth module.
4. Android Runtime
ART is written to run multiple virtual machines on low-memory devices by executing DEX files,
a byte code format designed especially for Android that's optimized for minimal memory
footprint.
Some of the major features of ART include the following:
Ahead-of-time (AOT) and just-in-time (JIT) compilation

Optimized garbage collection (GC)

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

Q.2] Explain Basic Component of Android?

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.

An activity is implemented as a subclass of Activity class as follows


public class MainActivity extends Activity {
}

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.

public class MyReceiver extends BroadcastReceiver {


public void onReceive(context,intent){}
}

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.

public class MyContentProvider extends ContentProvider {


public void onCreate(){}
}
G.P.S
COCSIT LATUR

Q.3] Write a note on Activity Lifecycle?

Android Activity Lifecycle 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. By the help of activity, you can place all your UI
components or widgets in a single screen. The 7 lifecycle method of Activity describes how
activity will behave at different states.

1] onCreate- called when activity is first 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 your activity is stopped, prior to start.
7] onDestroy - called before the activity is destroyed.
G.P.S
COCSIT LATUR

Q.4] Write a note on DVM?

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

Q.5] Explain Android Application Structure?

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

Q.6] Write a note on Android Manifest.xml?

The AndroidManifest.xml file contains information of your package, including components of


the application such as activities, services, broadcast receivers, content providers etc.

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>

You might also like