Android Hello World App Tutorial - Your Step by Step Guide

Photo of Mike Dalisay
Modified Sunday, May 8, 2011
by - @ninjazhai
I had a previous post "Getting Started with Google Android Development" where we installed our development environment. Please refer to that first if you're not yet done with it. In this post, we are going to do a program that will simply put a "Hello Android!" text on the screen of our android device. This is just a simple "Hello World!" program - just an Android version. Haha!

Step by Step HelloAndroid Tutorial
Hello there! :)

Step 1: We have to Install at least one Android platform for it is required to run an android application. To do that, we have to follow the simple steps on this link: Installing an Android platform

Step 2: From eclipse, select File > New > Project (Not Java Project). New project wizard will pop up. On the list, select Android Folder > Android Project > Next

Step 3: You are now in the New Android Project Dialog Box. Supply the following:
1. Project Name: HelloAndroid
  • This is the name of the directory that will contain the project files.
2. Application Name: Hello Android App
  • This is the name that will appear on the Android device
3. Package Name: com.example.helloandroid
  • This is the package namespace that you want all your source code to reside under. It must be unique across all packages installed on the Android system
4. Create Activity: HelloAndroid
  • This is the name for the class stub that will be generated by the plugin
5. Min SDK Version: 4
  • This value specifies the minimum API Level required by your application. Since I am using Android 1.6 platform for now, we'll enter "4".
Step 4: Click Finish

You may now browse and see the code by double clicking it.

Step 5: Browse the code. Inside file is the auto generated code:

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) {
Change that to these codes. The highlighted codes were added. tv.setText("Hello, Android"); Displays the text to the application's 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");
Step 6: Run the application. 

To run the application, for now, we will export it as .apk file. APK file is used for distributing and installing bundled components onto the Android operating system.

After clicking export, an export dialog box will appear, we have to choose Android Folder > Export Android Application > Next > Project: HelloAndroid > Next Button

We are now in the Keystore selection dialog, since this is our first application we have to select Create new keystore radio button. For now, we will supply the following information in the form

Location: C:\JM_FILES\JAVA\KEYS\HelloAndroidKey
Password: asdfasdf
Confirm: asdfasdf

Then Click the Next Button to proceed with the Key Creation. We're gonna supply the following information:

Alias: HelloAndroidAlias
Password: asdfasdf
Confirm: asdfasdf
Validity: 25
First and Last Name: Your Name
Organizational Unit: IT
Organization: IT Org
City or Locality: Antipolo
State or Province: Rizal
Country Code (XX): 18700

Then Click the Next Button

For the destination of APK file, we'll have: C:\JM_FILES\JAVA\APK\HelloAndroid.apk

Hit the Finish Button

We will now copy the HelloAndroid.apk file to our Android device > Click to install.

You should see "Hello Android!" text when you run the application so you know that our exercise works!

If you're gonna proceed with total android applications development, you must use the Android Debug Bridge. It will save you a lot of time in debugging. To use that, I got the following useful resources:

Other resources:

That's it! I hope I helped you with your first android application. :)
For FREE programming tutorials, click the red button below and subscribe! :)
Thanks for the comments!
"First do it, then do it right, then do it better."
~ Addy Osmani
"Talk is cheap. Show me the code."
~ Linus Torvalds
Let's Stay Connected!
g+ r
Android app on Google Play
© 2011-2014 The Code Of A Ninja. All rights reserved. Proudly Powered by Google Blogger. Images, logos, marks or names mentioned herein are the property of their respective owners.