project structure

Writing HelloWorld in Android

Objective :

  • How to write HelloWorld Application in Android?
  • How to write HelloWorld App in Android?
  • How to write HelloWorld in Android?

To create HelloWorldApp follow the steps below :

  • Go to File Menu > Go to New > Click on Android Application Project.

  • In New Android Application Window, enter Application Name as “HelloWorldApp”. Do not change anything else and click Next.

  • While you are in Configure Project Window, uncheck the Create custom launcher icon. Do not change anything else. Click Next.

  • In Create Activity window, click Next.

  • In Blank Activity Window, change the Activity Name to “HelloWorldApp”. Do not change anything else. Click Finish. And your HelloWorldApp Android application will be created.

Here is snapshot of HelloWorldApp project structure :

HelloWorldApp Project Structure in Android

XML Code for UI

File : activity_hello_world_app.xml

[sourcecode language=”xml”]

<RelativeLayout xmlns:android=""
android:orientation="vertical" >

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


XML code which manages all the string items or labels.

File : strings.xml

[sourcecode language=”xml”]
<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">HelloWorldApp</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>


Java Code

File :

[sourcecode language=”java”]
package com.example.helloworldapp;

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

public class HelloWorldApp extends Activity {

public void onCreate(Bundle savedInstanceState) {


After writing your code, to run this snippet you need an AVD (Android Virtual Device) or Emulator. Here is tutorial link which will help you to create AVD so as to run your Android application.