Hello World Program Application in Android Using Eclipse

Hello World Program Application in Android Using Eclipse

Hello world program application in Android using eclipse. It is the first step when we develop any application in any language. Before we create an Android Hello World Project, we need to make Virtual Device. It means after we create the android application, where we will run and test our application? For this we have 2 options. One is a real android device and second option is a Virtual device (Device Emulator, which android provides by default), To setup the virtual device, we need to follow the below steps.

1. Open SDK Manager and choose Virtual Devices. Click New... to make a new Virtual Device.

virtual-device-setup-in-android

2. Set the option like the picture below (or you can set on your own option) and click Create AVD.

create-avd

3. Okay, that’s all for Virtual Device.

1. Next, open eclipse again. Open FIle > New > Project…. Choose Android Project and then click Next.

start-new-android-project

new-android-project-creation-path

2. Fill the options like 2 pictures below and click Finish.

New_Project

Note: In the above picture, Target name is selected “Android 2.2”. It is nothing but the android OS version (if you want to select Android 3.0 or Android 4.0 etc, then you can do that), then its corresponding API version is 8, so you put the Mini SDK Version as per the Android OS version. Here the mini SDK Version is 8 as I have selected Android 2.2. Have a look on the below table for details.

Application Name: HelloWorld (You can give name)

Package Name: com.test.helloworld (you can give any name in this format)

Create Activity: HelloWorldApp (You can also give any name; this is your display screen name here).

3. To test the application, click run button and choose Android Application, if Run As windows appears. Wait until Virtual Device appears (It’s very slow, depend on your system).

run-android-from-menurun-android-from-menu-select

4. Finally, you’ll see something like this. If your emulator opens for the first time, then it will take 5-10 minuts, so don’t worry. Just wait.

First_hello-world-App_on-emulator

This is your first “Hello World” program in android. You have successfully run the first android application on a emulator.

downloadDownload Hello World Android Application Source Code from Here

  • For Hello World Directory Structure and Description Click Here.
  • For Hello World Source Code Description Click Here.

 

Post By SmrutiRanjan (54 Posts)

Working @ Samsung as a Project Lead for Android Smartphones. I have been blogging since 2008. Previously I was writing articles for other bloggers, but finally I have started my own blog-"Techblogon".I am also an active contributor for the blog-"Gadgets n Gizmos World". Job is my necessity, but blogging is my passion.

Website: → Techblogon

Connect

14 Responses to Hello World Program Application in Android Using Eclipse

  1. Jon P Salas says:

    I want to use the HelloWorld example but I am using Windows Vista Ultimate SP 1, and Android 4.2.2 platform. Would that work?

  2. Akila says:

    I installed android sdk manager, but while creating new avd target and CPU/ABI drop down list is not enabled. What i can do to enable that.

  3. madhavi says:

    hai i downloded the project when the time of importing ists suggesting pls select any porject while iam selection api demos folder pls upload correct zip here thanks in advnce

  4. jayashankar says:

    Starting emulator for AVD ‘android30′
    emulator: ERROR: Unable to load VM from snapshot. The snapshot has been saved for a different hardware configuration.

    - i got the above error on my first application. request your advice

    • SmrutiRanjan says:

      1. Goto android virtual device manager, then edit the emulator,uncheck the enable check box under snapshot.
      If the above trick does not work for you, then follow the below steps.
      1.Go to project and select Clean
      2. Go to Window->AVD Manager>Delete, then create a new AVD
      3. Relaunch your android application, your emulator will take a few minutes to load.

  5. waheed says:

    nice tutorial bro

  6. preethi says:

    hai,this was one of the best blogs for android tutorial thanx……i ve some basic knowledge about android but i could not write coding on my own…how you learned to write coding in android,and plz tell me some ideas to do mini projects in android…

  7. Amruta says:

    When I start the AVD, it does not load the .apk into it. When I right click on the project again and runs the application, a new instance of AVD starts, again with the same issue. Kindly help.

  8. hari says:

    sir,
    i want to install ADT plugin from ADT zip file. i tried eclipse 3.6.2 helios and ADT 21 & ADT 22 (both tried) but it gives error that missing Android dev Tools ( com.android.ide.eclipse.adt.feature.group 22.0.1.v…..–68575 )

    pls tell the steps from start and tell the version of everything. pls help me.

    regards
    hari

  9. Chandrasekhar Malladi says:

    I am actually trying to develop Hello World on eclipse juno 4.2.2.
    The mainactivity.java code gives an error saying R cannot be resolved in to a variable.
    Please check the code below and give the necessary corrections that have to be done so that the code can be compiled.
    Thank you.

    Code-
    package com.example.myfirstapp;

    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;

    public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
    }

    }

  10. fos1 says:

    Hi, thanks for your effort. However, most of your examples aren’t based on the latest SDK, even though you say your old code will work. I’m having a lot of problems running your examples on the AVDs, mostly because the dialog boxes don’t match the ones that comes with the latest kits. The only example I managed to run after a long battle was the HelloWorld app. Also,please describe the concepts before you use them in your discussion like toast and layouts. If this tutorial is bit reorganized, it will be one of best android app development sites on the net. Again thanks for your efforts.

Leave a Reply

Your email address will not be published. Required fields are marked *


nine − 7 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Close
Please support the site
By clicking any of these buttons you help our site to get better

Twitter

Facebook

Google+