An Android Application Development Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

This paper talks briefly about developing applications on the android mobile platform using the Java Programming language. The overview includes introduction to the android platform features, architecture, APIs, application framework and the android SDK. A Hello World application walks you through the development process to understand the concepts of the android software stack and the tools involved.

In late 2007, a group of industry leaders came together around the Android Platform to

form the Open Handset Alliance ( Some of the alliance's

prominent members include • Sprint Nextel • T-Mobile • Motorola • Samsung • Sony Ericsson • Toshiba • Vodafone • Google • Intel • Texas Instruments. Android was designed to serve the needs of mobile operators, handset manufacturers, and application developers [3].

Android is:

A software stack for mobile devices that includes an operating system (Linux Kernel version 2.6), middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language [1].

The Figure1: "Android Architecture diagram" gives a good overview of what constitutes the android platform. Android includes a set of C/C++ libraries (indicated green in Figure1) used by various components of the Android system. These capabilities are exposed to developers through the Android application framework.

Android Platform Features:

The following is an explanation of the building blocks of the platform as indicated in Figure1.

Application framework: Developers have full access to the same framework APIs used by the core applications (refer Figure1) written in Java. An application can publish its capabilities and any other application may then make use of those capabilities. Underlying all applications is a set of services and systems, including:

A rich and extensible set of Views that can be used to build an application, including

lists, grids, text boxes, buttons, and even an embeddable web browser

Content Providers that enable applications to access data from other applications (such as

Contacts), or to share their own data

A Resource Manager, providing access to non-code resources such as localized strings,

graphics, and layout files

A Notification Manager that enables all applications to display custom alerts in the status


An Activity Manager that manages the lifecycle of applications and provides a common

navigation backstack

Dalvik virtual machine optimized for mobile devices, executes files in the Dalvik

Executable (.dex) format. The 'dx' tool included in the SDK converts .class files into .dex


Integrated browser based on the open source WebKit engine

Optimized graphics powered by a custom 2D graphics library; 3D graphics based on

the OpenGL ES 1.0 specification (hardware acceleration optional)

SQLite for structured data storage

Media support for common audio, video, and still image formats (MPEG4, H.264,


GSM Telephony (hardware dependent)

Bluetooth, EDGE, 3G, and WiFi (hardware dependent)

Camera, GPS, compass, and accelerometer (hardware dependent)

Rich development environment including a device emulator, tools for debugging,

memory and performance profiling, and a plugin for the Eclipse IDE

Application Fundamentals:

Android applications are written in the Java programming language. The compiled Java code along with any data and resource files required by the application is bundled by the aapt tool into an Android package, an archive file marked by an .apk suffix. This file is the vehicle for distributing the application and installing it on mobile devices; it's the file users download to their devices. All the code in a single .apk file is considered to be one application. By default, every application runs in its own Linux process, with a unique linux user id. Each process has its own virtual machine (VM).

Application Components:

Android applications consist of loosely coupled components, bound using a project manifest that describes each component and how they interact. There are six components that provide the building blocks for your applications:

1) Activities:

Your application's presentation layer. Every screen in your application will be an

extension of the Activity class. Activities use Views to form graphical user interfaces that

displays information and respond to user actions. In terms of desktop development, an

Activity is equivalent to a Form.

2) Services:

Services are the invisible workers of your application. Service components run invisibly,

updating your data sources and visible Activities and triggering Notifi cations. They're used

to perform regular processing that needs to continue even when your application's Activities

aren't active or visible.

3) Content Providers:

Are a shareable data store. Content Providers are used to manage and share application

databases. Content Providers are the preferred way of sharing data across application

boundaries. This means that you can confi gure your own Content Providers to permit access

from other applications and use Content Providers exposed by others to access their stored

data. Android devices include several native Content Providers that expose useful databases

like contact information.

4) Intents:

They are simple message-passing framework. Using Intents, you can broadcast messages

system-wide or to a target Activity or Service, stating your intention to have an action

performed. The system will then determine the target(s) that will perform any actions as


5) Broadcast Receivers:

By creating and registering a Broadcast Receiver, your application can listen for broadcast

Intents that match specific filter criteria. Broadcast Receivers will automatically start your

application to respond to an incoming Intent, making them ideal for event-driven


6) Notifications:

They are user notification framework. Notifi cations let you signal users without stealing

focus or interrupting their current Activities. They are the preferred technique for getting

a user's attention from within a Service or Broadcast Receiver. For example, when a device

receives a text message or an incoming call, it alerts you by fl ashing lights, making sounds,

displaying icons, or showing dialog messages. You can trigger these same events from your

own applications using Notifications. By decoupling the dependencies between application

components, you can share and interchange individual pieces, such as Content Providers or

Services, with other applications - both your own and those of third parties.

The manifest file:

The AndroidManifest.xml file is where your global settings are made. If you are an

ASP.NET developer, you can think of AndroidManifest.xml as Web.config and

Global.asax rolled into one. (If you are not an ASP.NET developer, this means that

AndroidManifest.xml is a place for storing settings.) AndroidManifest.xml will include

such settings as application permissions, Activities, and intent filters. [4]

Please refer to Code 1: Manifest file

Building Hello World Application:

We will write the first android application, Hello World, using the eclipse IDE.

Make sure that you have a suitable version of Eclipse(3.5 or 3.6 recommended) installed on

your computer. Download the windows .zip file for the SDK starter package. Unpack the

SDK files into a directory named android-sdk-<machine-platform> in a safe location on

your computer.

Next, install the Eclipse(3.5 or 3.6) ADT plug-in for Android as follows:

Start Eclipse, then select Help > Install New Software....

Click Add, in the top-right corner.

In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the

following URL for the Location:

In Available Software dialog, select checkbox next to Developer Tools, click Next

In the next window, you'll see a list of the tools to be downloaded. Click Next.

Read and accept the license agreements, then click Finish.

When the installation completes, restart Eclipse.

Then, configure ADT by doing following steps:

Select Window > Preferences... to open the Preferences panel

Select Android from the left panel.

For the SDK Location in the main panel, click Browse... and locate your downloaded

SDK directory.

Click Apply, then OK.

Now, to install a platform in Eclipse:

In the Android SDK and AVD Manager, choose Available Packages in the left panel.

Click the repository site checkbox to display the components available for installation.

Select at least one platform to install, and click Install Selected. If you aren't sure which

platform to install, use the latest version.

Go on, and create an AVD:

In Eclipse, choose Window > Android SDK and AVD Manager.

Select Virtual Devices in the left panel.

Click New. (The Create New AVD dialog appears.)

Type the name of the AVD, such as "my_avd".

Choose a target. The target is the platform (that is, the version of the Android SDK, such

as 2.1) you want to run on the emulator.

You can ignore the rest of the fields for now.

Click Create AVD.

Create a New Android Project:

After you've created an AVD, the next step is to start a new Android project in Eclipse.

Please refer to Figure 1&2: New Android Project and also follow the steps below.

Fill in the project details with the following values:

Project name: HelloAndroid

Application name: Hello, Android

Package name: com.example.helloandroid (or your own private namespace)

Create Activity: HelloAndroid

Click Finish.

Here is a description of each field:

Project Name: The name of the directory that will contain the project files.

Application Name: This is the human-readable title for your application - the name that

will appear on the Android device.

Package Name: This is the package namespace (following the same rules as for packages

in the Java programming language) that you want all your source code to reside under. This

also sets the package name under which the stub Activity will be generated.

Your package name must be unique across all packages installed on the Android system; for this reason, it's important to use a standard domain-style package for your applications. The example above uses the "com.example" namespace, which is a namespace reserved for example documentation - when you develop your own applications, you should use a namespace that's appropriate to your organization or entity.

Create Activity

This is the name for the class stub that will be generated by the plugin. This will be a subclass of Android's Activity class. An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an Activity is almost always used as the basis for an application.

Min SDK Version: This value specifies the minimum API Level required by your application. For more information, see Android API Levels.

Other fields: The checkbox for "Use default location" allows you to change the location on disk where the project's files will be generated and stored. "Build Target" is the platform target that your application will be compiled against (this should be selected automatically, based on your Min SDK Version). Notice that the "Build Target" you've selected uses the Android 1.1 platform. This means that your application will be compiled against the Android 1.1 platform library. If you recall, the AVD created above runs on the Android 1.5 platform. These don't have to match; Android applications are forward-compatible, so an application built against the 1.1 platform library will run normally on the 1.5 platform. The reverse is not true.

Your Android project is now ready. It should be visible in the Package Explorer on the left. Open the file, located inside HelloAndroid > src > com.example.helloandroid). Please refer to Code2: HelloAndroid. Notice that the class is based on the Activity class. An Activity is a single application entity that is used to perform actions. An application may have many separate activities, but the user interacts with them one at a time. The onCreate() method will be called by the Android system when your Activity starts - it is where you should perform all initialization and UI setup. An activity is not required to have a user interface, but usually will. Now let's modify some code!

Construct the UI

Please refer to Code 3: Construct UI

An Android user interface is composed of hierarchies of objects called Views. A View is a drawable object used as an element in your UI layout, such as a button, image, or (in this case) a text label. Each of these objects is a subclass of the View class and the subclass that handles text is TextView. In this change, you create a TextView with the class constructor, which accepts an Android Context instance as its parameter. A Context is a handle to the system; it provides services like resolving resources, obtaining access to databases and preferences, and so on. The Activity class inherits from Context, and because your HelloAndroid class is a subclass of Activity, it is also a Context. So, you can pass this as your Context reference to the TextView.

Next, you define the text content with setText(). Finally, you pass the TextView to setContentView() in order to display it as the content for the Activity UI. If your Activity doesn't call this method, then no UI is present and the system will display a blank screen.

There it is - "Hello, World" in Android! The next step, of course, is to see it running.

Run the Application:

The Eclipse plugin makes it easy to run your applications:

Select Run > Run.

Select "Android Application".

The Eclipse plugin automatically creates a new run configuration for your project and then launches the Android Emulator. Depending on your environment, the Android emulator might take several minutes to boot fully, so please be patient. When the emulator is booted, the Eclipse plugin installs your application and launches the default Activity. You should now see something like this: Please refer to Figure 4: Hello Android. The "Hello, Android" you see in the grey bar is actually the application title. The Eclipse plugin creates this automatically (the string is defined in the res/values/strings.xml file and referenced by your AndroidManifest.xml file). The text below the title is the actual text that you have created in the TextView object.


That concludes the basic "Hello World" tutorial. Refer to for more information. To do that, android offers a number of APIs for developing your applications. The following list of core APIs that provide an insight into what's available; all Android devices will offer support for at least these Java APIs[2]:

android.util: The core utility package contains low-level classes like specialized containers,

string formatters, and XML parsing utilities. A high-level API that provides access to native map controls

that you can use within your application. Includes the MapView control as well as the

overlay and MapController classes used to annotate and control your embedded maps.

android.text: The text processing tools for displaying and parsing text.

android.database: low-level classes required for working with databases.


Figure 1: Android Architecture Diagram

Figure2: New Android Project

Figure3: New Android Project

Figure 4: Hello Android

Code 1: Manifest File

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

<manifest . . . >

<application . . . >

<activity android:name="com.example.project.FreneticActivity"



. . . >


. . .



Code 2: HelloAndroid

package com.example.helloandroid;


import android.os.Bundle;

public class HelloAndroid extends Activity {

    /** Called when the activity is first created. */


    public void onCreate(Bundle savedInstanceState) {





Code 3: Construct UI

package com.example.helloandroid;


import android.os.Bundle;

import android.widget.TextView;

public class HelloAndroid extends Activity {

   /** Called when the activity is first created. */


   public void onCreate(Bundle savedInstanceState) {


       TextView tv = new TextView(this);

       tv.setText("Hello, Android");