This paper discussions briefly about expanding applications on the android mobile program using the Java Programming language. The introduction includes benefits to the android platform features, structures, APIs, application platform and the android SDK. A Hello there World application strolls 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 up together throughout the Android Platform to form the Open up Handset Alliance (http://www. openhandsetalliance. com). A number of the alliance's prominent people include:
Sprint Nextel T-Mobile
Sony Ericsson Toshiba
Android was designed to serve the needs of mobile operators, handset manufacturers, and application designers .
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 essential to begin expanding applications on the Android system using the Java programming language .
The Number1: "Android Architecture diagram" gives a good overview of what constitutes the android program. Android carries a set of C/C++ libraries (mentioned green in Body1) employed by various the different parts of the Android system. These functions are exposed to coders through the Android application framework.
The following can be an explanation of the inspiration of the platform as indicated in Number1.
Application platform: Creators have full usage of the same construction APIs employed by the core applications (refer Number1) written in Java. A credit card applicatoin can submit its functions and any application may then use those capabilities. Underlying all applications is a set of services and systems, including:
A rich and extensible group of Views you can use to build a credit card applicatoin, including
lists, grids, wording boxes, switches, and even an embeddable web browser
Content Providers that permit applications to access data from other applications (such as
Contacts), or to discuss their own data
A Resource Supervisor, providing access to non-code resources such as localized strings,
graphics, and layout files
A Notification Supervisor that permits all applications to show custom notifications in the status
An Activity Administrator that manages the lifecycle of applications and provides a common
Dalvik online machine optimized for mobile devices, executes data files in the Dalvik
Executable (. dex) format. The 'dx' tool included in the SDK converts. category data files into. dex
Integrated browser predicated on the open source WebKit engine
Optimized graphics run by a custom 2D images library; 3D images based on
the OpenGL ES 1. 0 specification (hardware acceleration optional)
SQLite for set up data storage
Media support for common audio tracks, video, and still image platforms (MPEG4, H. 264,
MP3, AAC, AMR, JPG, PNG, GIF)
GSM Telephony (hardware reliant)
Bluetooth, EDGE, 3G, and Wi-fi (hardware reliant)
Camera, Gps device, compass, and accelerometer (hardware centered)
Rich development environment including a device emulator, tools for debugging,
memory and performance profiling, and a plugin for the Eclipse IDE
Android applications are written in the Java program writing language. The compiled Java code along with any data and reference data required by the application is bundled by the aapt tool into an Android deal, an archive file marked by an. apk suffix. This data file is the vehicle for distributing the application and installing it on mobile devices; it's the record users download with their devices. All of the code in one. apk file is considered to be one application. By default, every software runs in its own Linux process, with a unique linux user identification. Each process has its virtual machine (VM).
Android applications consist of loosely coupled components, bound by using a project express that details each component and how they interact. You will find six components offering the building blocks for your applications:
Your application's demonstration layer. Every screen in your application will be an
extension of the experience course. Activities use Views to form graphical user interfaces that
displays information and react to user actions. In terms of desktop development, an
Activity is equivalent to a Form.
Services will be the invisible personnel of the application. Service components run invisibly,
updating your computer data sources and visible Activities and triggering Notifi cations. They're used
to perform regular processing that must continue even when your application's Activities
aren't energetic or obvious.
Are a shareable data store. Content Providers are used to control and show application
databases. Content Providers will be the preferred way of posting 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 open by others to gain access to their stored
data. Android devices include several indigenous Content Providers that expose useful databases
like contact information.
They are simple message-passing construction. Using Intents, you can broadcast messages
system-wide or to a focus on Activity or Service, proclaiming your intention to have an action
performed. The system will determine the prospective(s) that will perform any activities as
By creating and registering a Broadcast Device, the application can listen closely for broadcast
Intents that match specific filtration system criteria. Broadcast Receivers will automatically start your
application to react to an incoming Intention, making them well suited for event-driven
They are individual notification construction. Notifi cations enable you to signal users without stealing
focus or interrupting their current Activities. They will be the preferred way of getting
a user's attention from within a Service or Broadcast Recipient. For example, whenever a device
receives a text message or an inbound call, it alerts you by fl ashing lighting, making sounds,
displaying icons, or displaying dialog messages. You can trigger these same incidents from your
own applications using Notifications. By decoupling the dependencies between application
components, you can promote and interchange specific items, such as Content Providers or
Services, with other applications - both your own and the ones of third people.
The AndroidManifest. xml data file is where your global configurations are made. If you are an
ASP. NET creator, you can think of AndroidManifest. xml as Web. config and
Global. asax rolled into one. (If you're not an ASP. NET creator, this implies that
AndroidManifest. xml is a location for storing configurations. ) AndroidManifest. xml will include
such configurations as request permissions, Activities, and objective filters. 
Please make reference to Code 1: Express file
We will write the first android software, Hello World, using the eclipse IDE.
Make sure you have a suitable version of Eclipse(3. 5 or 3. 6 recommended) installed on
your computer. Download the house windows. zip apply for the SDK starter package deal. Unpack the
SDK data files into a listing named android-sdk- in a safe location on
Start Eclipse, then choose Help > Install New Software. . . .
Click Add, in the top-right nook.
In the Add Repository dialog that shows up, enter in "ADT Plugin" for the Name and the
following URL for the Location: https://dl-ssl. yahoo. com/android/eclipse/
In Available Software dialog, go for checkbox next to Designer Tools, click Next
In another window, you'll see a list of the tools to be downloaded. Click Next.
Read and allow the license contracts, then click Surface finish.
When the set up completes, restart Eclipse.
Select Window > Tastes. . . to open up the Personal preferences panel
Select Android from the left panel.
For the SDK Location in the key panel, click Surf. . . and locate your downloaded
SDK directory website.
Click Apply, then Okay.
In the Android SDK and AVD Manager, choose Available Packages in the kept panel.
Click the repository site checkbox to show the components available for installation.
Select at least one system to set up, and click Install Selected. If you aren't sure which
platform to set up, use the latest version.
In Eclipse, choose Windowpane > Android SDK and AVD Supervisor.
Select Virtual Devices in the left panel.
Click New. (The Create New AVD dialog shows up. )
Type the name of the AVD, such as "my_avd".
Choose a target. The mark is the platform (that is, the version of the Android SDK, such
as 2. 1) you want to perform on the emulator.
You can disregard the remaining fields for now.
Click Create AVD.
After you've created an AVD, the next thing is to start a new Android job in Eclipse.
Please refer to Determine 1&2: New Android Project and also follow the steps below.
Fill in the job details with the next values:
Project name: HelloAndroid
Application name: Hello, Android
Package name: com. example. helloandroid (or your own private namespace)
Create Activity: HelloAndroid
Here is a information of every field:
Project Name: The name of the index that will contain the project documents.
Application Name: This is the human-readable name for your application - the name that
will seem on the Android device.
Package Name: This is the bundle namespace (following the same rules as for packages
in the Java program writing language) that you want your source code to reside under. This
also models the deal name under which the stub Activity will be produced.
Your deal name must be unique across all plans installed on the Android system; because of this, it is critical to use a standard domain-style bundle for your applications. The example above uses the "com. example" namespace, which really is a namespace reserved for example paperwork - when you develop your own applications, you need to use a namespace that's appropriate to your organization or entity.
This is the name for the class stub that'll be produced by the plugin. This will be a subclass of Android's Activity class. An Activity is merely a category that can run and do work. It could create a UI if it chooses, but it generally does not need to. As the checkbox advises, this is optional, but a task is almost always used as the basis for an application.
Min SDK Version: This value specifies the minimum API Level required by the application. To find out more, see Android API Levels.
Other areas: The checkbox for "Use default location" gives you to change the positioning on disk where in fact the project's documents will be generated and stored. "Build Aim for" is the program target that your application will be put together against (this will be selected automatically, predicated on your Min SDK Version). Observe that the "Build Target" you've preferred uses the Android 1. 1 program. Which means that your application will be put together from the Android 1. 1 system library. If you recall, the AVD created above works on the Android 1. 5 platform. These need not match; Android applications are forward-compatible, so an application built contrary to the 1. 1 platform collection will run normally on the 1. 5 platform. The reverse is not true.
Your Android task is currently ready. It ought to be noticeable in the Bundle Explorer on the departed. Start the HelloAndroid. java record, located inside HelloAndroid > src > com. example. helloandroid). Please refer to Code2: HelloAndroid. Notice that the class is dependant on the Activity class. A TASK is an individual request entity that is utilized to perform activities. A credit card applicatoin may have many separate activities, but the individual interacts with them one at a time. The onCreate() method will be called by the Android system whenever your Activity starts off - it is where you should perform all initialization and UI setup. An activity is not needed to have a interface, but usually will. Now let's modify some code!
Please refer to Code 3: Build UI
An Android interface is composed of hierarchies of things called Views. A View is a drawable thing used as an component in your UI design, like a button, image, or (in cases like this) a word label. Each of these items is a subclass of the View category and the subclass that deals with word is TextView. In this change, you make a TextView with the category constructor, which allows an Android Context instance as its parameter. A Context is a deal with to the machine; it offers services like resolving resources, obtaining access to databases and personal preferences, and so on. The Activity school inherits from Context, and because your HelloAndroid course is a subclass of Activity, it is also a Context. So, you can move this as your Context reference to the TextView.
Next, you define the text content with setText(). Finally, you cross the TextView to setContentView() to be able to display it as this content for the Activity UI. When your Activity doesn't call this technique, then no UI exists and the machine will screen a blank display screen.
There it is - "Hello, World" in Android! The next phase, of course, is to see it running.
The Eclipse plugin helps it be easy to perform your applications:
Select Run > Run.
Select "Android Program".
The Eclipse plugin automatically creates a new run construction for your project and then launches the Android Emulator. Based on your environment, the Android emulator usually takes several minutes on top of that fully, so please show patience. Once the emulator is booted, the Eclipse plugin installs the application and launches the default Activity. You should now see something like this: Please refer to Amount 4: Hello Android. The "Hello, Android" the simple truth is in the grey bar is in fact the application name. The Eclipse plugin creates this automatically (the string is described in the res/values/strings. xml file and referenced because of your AndroidManifest. xml record). The written text below the name is the genuine text as created in the TextView subject.
That concludes the basic "Hello World" tutorial. Refer to http://developer. android. com/index. html to find out more. To do that, android offers a number of APIs for producing your applications. The next list of center APIs offering an information into what's available; all Android devices will offer support for at least these Java APIs:
android. util: The key utility package is made up of low-level classes like specialized containers,
string formatters, and XML parsing utilities.
com. google. android. maps: A high-level API that provides access to local map controls
that you can use within your request. Includes the MapView control as well as the
overlay and MapController classes used to annotate and control your embedded maps.
android. text: The text handling tools for exhibiting and parsing text message.
android. database: low-level classes required for working with directories.
package com. example. helloandroid;
import android. app. Activity;
import android. operating-system. Bundle;
public class HelloAndroid extends Activity
/** Called when the activity is first created. */
general public void onCreate(Pack savedInstanceState)
setContentView(R. design. main);
package com. example. helloandroid;
import android. app. Activity;
import android. operating-system. Bundle;
public category HelloAndroid stretches Activity
/** Called when the experience is first created. */
general population void onCreate(Bundle savedInstanceState)