Android Hello World Example

hello world android

Android is now one of the most popular smartphone/mobile operating system in the world. This tutorial will help you on creating your first android application (Hello World application) using Eclipse IDE and Android Development Tools (ADT) and also Android Virtual Device (AVD) or your real android device to run the application.

Tools used in this tutorial:
1. JDK 1.6
2. Eclipse IDE
3. Android SDK

Note
I suggest you to use ADT Bundle so installing ADT plugin in Eclipse is not required. You can download it here ADT Bundle

1. Create Android Project

Select File–>New–>Other–>Android Application Project and click Next Button
android hello world

2. Configure Project Settings

Enter your Application Name, Project Name and Package Name. Select Minimum Required SDK, the lowest version of Android that the application supports. Target SDK, the highest version of Android. Compile With, android version which the application will be compiled with. And Theme. If you are not sure, just leave it as it is. Click Next.
2

Click Next again

3

3. Configure Launcher Icon

Create you launcher icon as you want or as you requirements need. In this tutorial i have changed few default settings.
4

4. Create Activity

Choose an activity BlankActivty template and click Next. An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI.
5

Enter Activity Name and click Finish

6

5. Project Structure

Here is the project structure generated by the IDE
7

the layout file (activity_hello.xml) is shown in the Graphical Layout mode as follow
8

6. Code

Open string.xml and there is string property with name hello_world which contains value as ‘Hello world!’ that is used by TextView to be shown in our application.

file : string.xml

Open activity_hello.xml and you should see the element. Take a look at “android:text=”@string/hello_world”. The “@string/hello_world” refers to “Hello world!” in string.xml

file : activity_hello.xml

And here’s our activity

file : MainActivity.java

We don’t need to change any code yet.

7. Run Configuration

Right click on the project and select Run As–>Run Configurations. If there is no AVD already created, create it by click Manager
9

Click New
10

Configure AVD as you wish or follow like below
11

8. Run Application

Right click on the project and select Run As–>Android Application

9. Running Program

Eclipse will running AVD and our application should be there.
12

Click on Hello World icon, and here’s what our application looks like, very basic application
13

Facebook Comments
 

Agung Setiawan

Agung Setiawan adalah software engineer di BukaLapak.com, penulis sekaligus pecinta sastra, dan pembaca buku

 
Halo, perkenalkan saya Agung Setiawan.
Saya Software Engineer di BukaLapak.
Simak pemikian saya soal dunia Software Engineering via Twitter di @agungsetiawanmu dan facebook
Blog ini saya update seminggu sekali jadi sering-sering saja mampir
Mau belajar Vim bareng saya?
Belajar ngoding dari nol menggunakan PHP

3 thoughts on “Android Hello World Example

    1. 😀
      iya ntar nyusul tutorial yang lain hehe

      MainActivity.java sama strings.xml itu bawaan hasil generate Eclipse pas pertama bikin project
      MainActivity.java bisa ditemukan di src/nama_paket/MainActivity.Java (pada contoh diatas nama_paket-nya com.agung.helloworld
      Sedangkan strings.xml bisa dilihat di res/values/strings.xml

Leave a Reply

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