Android Hello World Example

This tutorial shows how to create a simple Android hello-world project in Eclipse, and run the hello-world project on Android Virtual Device (AVD).

Summary steps to develop an Android application :

  1. Download and install Android SDK ADT Bundle for Windows
  2. Create Android Project by Using Eclipse Wizard
  3. Create an Android Virtual Device (AVD)
  4. View Result

This Android Hello-World project is developed under Windows 7, and JDK 1.6 has been installed previously.

1. Download and Install Android SDK ADT Bundle for Windows

Download Android SDK first: http://developer.android.com/sdk/index.html. This is the only tool you need to download to complete the following Hello-World example.

Unzip the downloaded file. (You can extract it to anywhere, but normally it should be under your program file directory.) There is an "eclipse" directory which already have Android development environment integrated. Go to the direction, and start eclipse by double clicking "eclipse".

2. Create Android Project by Using Eclipse Wizard

Create a new "Android Application Project" by following the wizard. The steps look like the following:

1-android-application-project

2-new-android-application

3-configure-project

4-configure-icon-set-android

5-create-an-activity

6-blank-activity

The project directory is like the following:
15-android-hello-world

Now the project is successfully created, the next step is to create a virtual smartphone for the Hello-World to run.

3. Create Android Virtual Device

If you run the created hello-world project at this moment, the project will not run. Because there is no device set up yet. To run an Android project, you will need to create an Android Virtual Device (AVD), so that the created project can run on a virtual smartphone under emulator. You can also directly go to "Android Virtual Device Manager" by clicking the icon on the toolbar like the following:

icon-android-virtual-device-manager

If you don't set up an AVD first and run th project, the The following windows will be popped up to ask you to create an AVD. You can follow the following steps. Since I have an Nexux 4, I will add Nexus 4 as my AVD to run the project.

7-add-new-android-virtual-device

8-android-virtual-devices-manager

9-create-avd

10-start-created-avd

4. View Result

11-lunch-option

12-run-emulator

13-helloworld

14-running-android-hello-world

In this post, you have seen a very simple Android Hello-World application. As shown above, Android project can be quickly developed by using eclipse with ADT integrated. The next step is understanding the content of the code.

Category >> Android  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>