Hello World Example in Android

In this tutorial we will see how to create Hello World Example application in android using Android Studio. Here we will use TextView widget and print Hello World message.

To begin with Hello World Example application start Android Studio and you will see message Welcome to Android Studio message. We will create new application so we will select “Start a new Android Studio project”.

Follow the steps to create Hello World program

Step 1

hello world example

Now you can see many small activities. To begin with we will select Empty Activity and press Next. This will create new blank Activity.

Step 2

project selection

Now enter you name in Name box. Example – Hello World

  • In Package name put you package name. Example – com.androidaura.helloworld
  • Next select location where this project should be saved.
  • In Language specify in which language you will be programming. Example we will select “Java” here.
  • Select minimum API Level to begin with. Example we have selected API 21: Android 5.0 (Lollipop)

Click on Finish button once done.

Step 3

name project

Once you created an application two files will be generated.

  • MainActivity.class
  • activity_main.xml

MainActivity.java is a class file in which you will write java program.

MainActivity.java

This is activity_main.xml file, here we will write code rated to xml. Below we are using TextView widget and will display Hello World! message. activity_main.xml

Press run button to run you application as shown below

Step 4

Select and emulator in which you want program should run.

Check below link if you don’t know how to create emulator in android.

Android Emulator

Step 5

android emulator

Below is the output of the program

Output

Hello World Example