Android Hello World Example

As a beginner to android everybody wants to write there first hello world application to make there hand wet and also to make ensure does development environment is set properly and also to check does the program executes correctly .

In this tutorial, we will see how to create a simple “hello world” Android project in Eclipse IDE + ADT plugin, and run it with Android Virtual Device (AVD).

So Before Developing your first android Hello world application , make sure you have setup development environment if not then visit the our following tutorials .

Development Environment Setup For Android

  1.    Install Android SDK and ADT Plugin for eclipse .
  2.    Create Android Virtual Device (AVD) .

Tools and Technology used in this tutorial

  1. JDK 1.7 
  2. Eclipse 4.2  ( Juno ) .
  3. Android SDK .
In eclipse menu bar go to File -->new -->Android Application Project

First Android Hello World example
Select the Android Application Project and click next

Enter the Application Details


Application Name  :   HelloWorldApp
Project Name  :  HelloWorldApp
Package Name  :  com.pavan.helloworldapp

Minimum Reqiured SDK  : Android 2.2 ( API level 8 )
Target SDk   :   Android 4.2 ( API level 17 )
Compile with :  Android 4.2 ( API level 17 )
Theme :  Holo light with Dark Acton Bar

Configure the Launcher Icon

you can add your own custom icon and edit it by setting it's shape to either square or circle and also you can add padding to it .

First Android Hello World example

First Android Hello World example
                                              Enter the activity name and layout name and click finish 

Project Structure

 Eclipse will create all the necessary Android project files and configuration.
First Android Hello World example

XML Layout

Create  activity_main.xml  file and  add textview  with a string value hello world 

file :-activity_main.xml
< LinearLayout
      tools:context=".MainActivity" >
    < Textview       
               android:textSize="30dp" >

 < /LinearLayout >


Create a MainActivity.class and extend it to activity class and override the onCreate() method of activity class and set the content of the actvity with the above defined xml file by calling setContentView() method and passing xml file name as a parameter to it


file :-
package com.pavan.helloworldapp;

import android.os.Bundle;

public class MainActivity extends Activity {

 protected void onCreate(Bundle savedInstanceState) {



click Run icon in eclipse toolbar or press( Ctrl+F11 ) to Run application in emulator .


First Android Hello World example

No comments:

Post a Comment