My First Android Program

It’s pretty exciting to write about developing first program in Android. In our first program, we are going to have an image and label on the Window.

Its a simple traditional ‘Hello World’ program.

Let us begin with it by opening new android project in eclipse.

Quick Links

Project Structure

Launch eclipse, open new android project in either of the two ways:

File >> New >> Others >> Android >> Android Project

File >> New >>Β Android Project

Click next and provide project name which is going to be your Activity Class name, so make sure your project name must suite your functionality of the application.

After providing project name, click next and choose Android target device version. You have to choose your device’s installed Android version.

Click next and provide package name. Package name must follow naming convention since a particular device will have multiple packages which should not be ambiguous at run time. So follow below mentioned naming scheme:

com.myapp.”Name of your app”



All done, you have successfully created ‘New’ android project. Let’s modify the default layout and add controls to the application we just created to bring an image – Android logo and label – Hello Android at the center of the device’s window as we discussed earlier.

Code Listings

To begin with layout modification, we need to add an image – Android logo to the resources folder and add text ‘Hello Android’ in strings.xml.

Expand Project folder >> res >> drawable-hdpi >> Place/Paste Android logo image

Expand values folder >> Open strings.xml >> Look for String ‘hello’ >> Add text ‘Hello Android’ to ‘hello’ string element

Open main.xml under res/layout folder and replace the xml with the below xml which has one image and one label aligned centrally.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
android:orientation="vertical" >

android:src="@drawable/android_logo" />

android:text="@string/hello" />


Open ‘Graphical layout’ of the main.xml, you could see the design of our application. Graphical layout allows you to design application UI just by doing simple drag and drop the controls.

Make sure ‘Build Automatically’ option under Project menu is selected so that project will be built automatically every time after you did change.


That’s it, we need to run the program and check the output.

Right click on the Project >> Run as >> Android Application >> Select emulator [configured at the time SDK installation] or Your Android device


Google installs ‘Emulator’ along with the SDK installation. It’s upto you whether you want to run the application in Emulator or in your android device. I would prefer to run my apps on my device since most of the services like GPS, Google inbuilt services, bluetooth etc are not supported in Emulator but still application will run without any issues in Emulator if your app doesn’t involve any of the aforementioned services.

You must enable ‘USB debugging’ in your mobile settings so that it will be acting as target device when connected to your PC. And its simple to run your app in Mobile device.
Here is our most awaited output:

Download Source Code

Entire project is zipped and is available for download. Unzip the downloaded project and to import the project into eclipse, launch eclipse >> File >> Import.. >> Choose downloaded project (How to import android project in eclipse). If you just want to run the application in your mobile and see the output but don’t want to hit your head with source code, download application(apk) file and install it in your mobile device.

Download Source Code Download Application(apk)

*apk in Android Β is the installation file simliar to exe in windows.

Keep me posted with your valuable feedback. πŸ™‚
Thanks for reading the post!!
Do share with your friends if you want to let others know about this content!!


Related Articles

Author: Udhay

Share This Post On
468 ad
  • Bhavani Sridhar


    Really superb..:). Keep up ur good work..

    • Thanks for comment πŸ™‚

  • Satheesh


    • Thanks for the comment πŸ™‚

  • Naresh

    Good to see you as a developer. Changeover from prod ops to dev..keep going πŸ™‚

    • Thanks Machi.. πŸ˜‰

  • Maheedhar

    Good Work Bro… πŸ™‚

    • Thanks man.. πŸ™‚

  • Vijayababu

    Really good…

  • leninkumar

    Hi.. Is there any possibilities to get stand alone android application for my marketing team. Bcos everyday they met more people, i decided to allow them to enter customer info into local database (android Mobile / Tabletpc). How come i am going to synchronize all the data which is captured by team. How to prepare the reports.

    I am not a technical guy. But I need application. If i am getting help from your forum i am very grateful.

    My mail id :

    • Hi Lenin,
      You should develop a custom android application to meet your requirements. You can create it by your own if you know something about Android programming. If not many companies are there who are developing Android apps,just contact them to convert your requirements to Android App. πŸ™‚

  • Ganesh

    Created my first Android program. Thanks for the tutorial πŸ™‚

  • hemalatha

    good work…

  • Anand

    Is there any possibilities to use android applications in Nokia serbian Phone.

    • Android applications cannot be run in platforms other than Android. If the applications are created/developed using framework like PhoneGap, they canbe run in all mobile platforms supported by PhoneGap. Follow this link: for more info.

  • safiullah

    hello sir can u send me or tell me this apllication site to my email ie(java escllipse).. plz sir

  • Jane

    hello everyone,, do i need to plug in my android phone to the computer while making this first app? thanks

  • You also have an option to test your App in Emulator. All you need to do is configure Emulator in your machine. Here are the steps –

    If you wish to use your Android mobile for testing your App, make sure you enabled ‘USB debugging’ [Settings > Developer options] in your mobile and connect it to machine.

    Refer this link – for running app on device.

Join now to get more access to our Android Tutorials

Join now to get more access to our Android Tutorials

Once you Join, you will receive Mail containing latest Android Tutorials once a month !!

I promise I wont spam you !!

You have Successfully Subscribed!

Pin It on Pinterest