Android Hello World Example

 

In this tutorial, we will create our first Android Hello World application.

 

1. Technologies used

  • JDK 1.6
  • Eclipse 4.2 (Juno)
  • Android SDK Tools 23.0.2
  • Android 4.4.2 (KitKat)

 

2. Install Android SDK Tools

Download the stand-alone Android SDK from Android SDK home and install it.

Start Eclipse and go to Window> Preferences> Android to set the SDK location :

Android-Hello-World-1

 

Go to window > Android SDK manager and choose which version of Android to install.

We can also update Android SDK if necessary.

Android-Hello-World-2

 

If Eclipse doesn’t show Android SDK Manager, go to Window >  Customize perspective > Command Groups Availability and check the “Android SDK and AVD Manager” option.

Android-Hello-World-3

 

3. Install ADT plugin

In Eclipse, go to Help > Install New Software, And use the following URL to download and install the ADT plugin.

https://dl-ssl.google.com/android/eclipse/

Android-Hello-World-5

 

4. Add an Android Virtual Device

It is an emulator configuration to model an actual device.

Go to Window > Android Virtual Device Manager and create a new Android Virtual Device : ADV1

Android-Hello-World-6

 

5. Create a new application

In Eclipse, Use File> New> Project> ..> Android> Android Application Project :

Android-Hello-World-7

We create a custom launcher icon :

Android-Hello-World-8

While creating activity, we choose a “Blank Activity” :

Android-Hello-World-9

 

In the end we will have the following project structure :

Android-Hello-World-10

In activity_hello_world.xml, we have a TextView composant to display a message when launching application.

@string/hello_world refers to a string resource defined in strings.xml.

hello_world variable contains the Hello World message

 

6. Run It

Run the application in the ADV1 :

Android-Hello-World-11

Click the application icon :

Android-Hello-World-12

 

Download source code