Hello World Example In Android

Android – Hello World Example

Let us start actual programming with Android Framework.

Create an Android Application

(1) The first step is to create a simple Android Application using Android studio. When you click on the Android studio icon, it will show a screen as shown below.


( 2 ) You can start your application development by calling start a new android studio project. in a new installation, frame should ask for Application name, package information, and location of the project.


(3) The next level of installation should contain selecting the activity to mobile, it specifies the default layout for Applications.



(4) At the final stage it going to be open development tool to write the application code.


Anatomy of Android Application
(5)Before you run your app, you should be aware of a few directories and files in the Android project


(1) AndroidManifest.xml

This is the manifest file that describes the fundamental characteristics of the app and defines each of its components.

(2) Java

This contains the .java source files for your project. By default, it includes a MainActivity.java source file having an activity class that runs when your app is launched using the app icon.


This is a directory for drawable objects that are designed for high-density screens.


This is a directory for files that define your app’s user interface.


This is a directory for other various XML files that contain a collection of resources, such as strings and colours definitions.


This is an auto-generated file which contains compileSdkVersion, build tools version, applicationId, minSdkVersion, targetSdkVersion, versionCode, and versionName


The Main Activity File:-

The main activity code is a Java file MainActivity.java. This is the actual application file that ultimately gets converted to a Dalvik executable and runs your application.

package com.android.android_helloworldexample;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    protected void onCreate(Bundle savedInstanceState) {


The Manifest File:-

Whatever component you develop as a part of your application, you must declare all its components in a manifest.xml which resides at the root of the application project directory. This file works as an interface between Android OS and your application, so if you do not declare your component in this file, then it will not be considered by the OS. For Example…

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

        <activity android:name=".MainActivity">
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />



The Strings File:-

The strings.xml file is located in the res/values folder and it contains all the text that your application uses. For example, the names of buttons, labels, default text, and similar types of strings go into this file. This file is responsible for its textual content. For Example.

    <string name="app_name">Android - Hello World Example</string>


The Layout File:-

The activity_main.xml is a layout file available in the

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"

        android:text="Hello World!"
        app:layout_constraintTop_toTopOf="parent" />



res/layout directory, that is referenced by your application when building its interface. You will modify this file very frequently to change the layout of your application. For your “Hello World!” application.

Output In My Application


Congratulations!!! you have developed your first Android Application and now just keep following the rest of the tutorial step by step to become a great Android Developer. All the very best.


Thank You For Visiting Us.

Submit a Comment

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


Select Categories