Thursday, October 27, 2011

Android Getting Started Hello World Example

I hope this post will help everyone those who want to start with Android applications.

To develop Android applications you should have a Android SDK  to run the dveloped application through the Virtual Emulator and Eclipse to develop the application.

1 .   To start with android, you need two main tools

1.1     Eclipse, you can download the eclipse as per the OS and hardware at here.

1.2     Android SDK , you can download it from here.

2 .  After downloading and installing it, you need to update the Android SDK to the required patform like Android 1.6,  Android              2.2 as  per  your want.

3 .  Downloading the ADT Plugin

Use the Update Manager feature of your Eclipse installation to install the latest revision of ADT on your                                        development    computer.

  1.     Start Eclipse, then select Help > Install New Software....

  2.     Click Add, in the top-right corner.

  3.     In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for                              the Location:

  4.     Click OK     Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https"        (https is               preferred for security reasons).

  5.     In the Available Software dialog, select the checkbox next to Developer Tools and click Next.

  6.     In the next window, you'll see a list of the tools to be downloaded. Click Next.

  7.     Read and accept the license agreements, then click Finish.Note: If you get a security warning saying that                      the authenticity or validity of the software can't be established, click OK.

  8.     When the installation completes, restart Eclipse.

 4. Configuring the ADT Plugin

After you've successfully downloaded the ADT as described above, the next step is to modify your ADT preferences               in Eclipse to point to the Android SDK directory:

  1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).

  2. Select Android from the left panel.

You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and                               click Proceed. You cannot continue with this procedure until you click Proceed.

  1.   For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.

  2.    Click Apply, then OK.

5 .   Creating new Virtual Emulator on Android SDK

5.1    In Eclipse, Click Windows->Android SDK and AVD Manager

5.2      Click the New button to create the new Virtual Emulator

and fill the Text box as shown in the figure above, then you will successfully create your Virtual Emulator.

6 .  Creating  "Hello world" application on android.

6.1.  In Eclipse  Go to File->New->Android Project,  then a Window will arise as shown below

6.2  Then your created Trial Package Consist of following files as shown below

6.3 Paste the following Code in Trail->res->Layout->main.xml

<?xml version="1.0" encoding="utf-8"?>
<EditText android:id="@+id/helloBox"
<Button android:id="@+id/helloButton"

The above code just create the Layout and it consist of one TextBox and Button

6.4 Paste the following code at Trail->src->com.example.trail->

package com.example.trail;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class TrialActivity extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

/*find the textbox created at the main.xml and create the object as helloBox */
final EditText helloBox=(EditText)findViewById(;

/*find the button created at main.xml and create the object as helloButton */
Button helloButton=(Button)findViewById(;

/*Set an OnClickListner(Which works when the Button is clicked) for the Button*/
helloButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {

/*Insert the Text when the button is clicked.*/
helloBox.setText("Hello World");


6.5 Save it and Run the application by Run->Run or CTRL+F11, then your application
starts running and the output is shown below


  1. Truly incredible post. I just discovered your site and needed to say that I have truly delighted in searching your blog entries. After all I will subscribe on your food and I’m trusting you compose yet again soon! Feel free to surf for getting new writing ideas. Vsit: Best essay writing service

  2. This comment has been removed by the author.

  3. Hmmm, when did Android launched? Was it before 2011? I don't remember already. I ended my school and started working for Bestdissertation in 08. But we all had Nokia phones that time. I think in a year or something iPhones became popular. And than came Android. Or not?