Blog Image

Hello World Application in Android  

Hi Guys, this article will guide you to create your first android application, this application will only display ?Welcome text message? on the screen but it is importance step to make sure your android development environment is working properly.

Before going to start application development, i will describe how to stepup Android into your machine.

Installing Android Studio:

  • Android Studio requires JDK, if it is not installed in your system, download JDK from oracle website and install it according to your preference.
  • After Installing JDK, Download Android Studio and SDK tools from official website its around 2GB file. So it make take time based on your internet connection.
  • After downloading android studio, open it and install, in the directory you like to.

  Accept all the default configurations for all step.
  Make sure all the components are selected for installation.

Create Project:

First of all, open Android Studio and then click the file menu and select New Project .

This is the first screen that you will see after selecting New Project, here we can set project properties

  1. Application Name: The name of the project, here is HelloWorld.
  2. Company Damian: Enter your company main name, for example
  3. Package Name: It is used for organize java classes into namespaces
  4. then click next.

This page is used to set a minimum version of Android that you want to support.

After selecting minimum SDK, click Next.

This page is the list of predefined Templates that you can use with your app. Select ?Empty Activity? because we want to work with basic application.

Then click Next and Finish.

After you will see your project structure, I will describe below       

app : all of your code and resources is here, some important directories to work with HelloWorld application java folder contains all source code files

res: it contains all resources like layouts, menus, asserts and images etc.

AndroidManifest.xml: this is Configuration file of Android application. We will configure launching page and all activities, services and all required permissions to run our application.

build.gradle: we can configure all project dependencies, min and max SDK versions and APK version name.

Layout File: The activity_main.xml is a linear layout file available in res/layout directory.







TextView is so called XML tag, layout_width and layout_height is to set size of the layout element.

andoid:text is to display text on the screen, better to avoid hardcoding string values in layout file and place it in string resource file as string.xml, it is available in res/values directory.


<string name="app_name">HelloWorld</string>

<string name="welcome_msg">Welcome to Android !</string>


Create MainActivity:

Write a java class that inherit from Activity class.

Activity class in android application represents the single screen of application, if you want to display something on the screen, you need to create an activity.

package com.balu.helloworld;


public class MainActivity extends AppCompatActivity {}

Then override onCreate(), it will called when the activity is created, it is used to initialize the activity, for example to create user interface.


protected void onCreate(Bundle savedInstanceState) {




Bundle is a class that is used to store and passing data between Activity or across application state.

setContentView() is used to attach layout ( user interface) to Activity.

Now you need to configure your activity class in AndroidManifest.xml file, it looks like

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="";











Package attribute: Your application package name, Android will use it to identify your application.

Application tag: It describes about your application such as app name, icon and theme. It contains components of your app such as activities, services and providers.

Declare all your activity in manifest file under application


<activity android:name="com.balu.helloworld.MainActivity">



<intent-filter> is used for describes that what the event that your Activity, Service or Receiver will interacts. When the android calls the application to start activity or emit the event, it will find responsible of that event by looking into intent-filter list.


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

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


Category: It refers to kind of this component such as launcher and browser etc.

Action: It refers to the standard actions that indicates the interaction of components such as main, web, search, pick etc.


apply plugin: ''

android {

compileSdkVersion 26

defaultConfig {

applicationId "com.balu.helloworld"

minSdkVersion 15

targetSdkVersion 26

versionCode 1

versionName "1.0"



dependencies {

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation ''

implementation ''

testImplementation 'junit:junit:4.12'

androidTestImplementation ''

androidTestImplementation ''


Build Application:

After completing the coding, we need to build APK file to run your application in your device.

To build project, click the menu Build option on the toolbar then select Make Project (ctrl + F9 as short for Windows OS). After made build Android Studio will show result on the status bar (Bottom of the screen).

When the Build Success the APK will be available in the path /build/outputs/apk you can see and deploy in your device or emulator.

Preparing Device for Development :

If you have Real Android Device you can deploy an application directly in your device, but you need to set something as follows:

Enable Developer Options

On the real device go to Settings, Then Scroll Down to the end. You will see the About Phone menu tap it, and tap on the Build Number for 7 times then it shows one message as You Are Developer.

Go back to Settings you will see Developer Options menu then turn on it and select Debugging option. Now your device is allowing you to deploy an application for debugging. Then Connect your device to System using USB cable and start your application (shift+F10) it show one popup showing devices list, select your device then it starts building your application.


tags: android

About author

User Image

Well ,This is Balu having experience in web/mobile application development, currently working as Software Engineer in one of the Product based company and very passionate technologies and always an explorer and learner in new technologies.



Be the first person to write a comment for this Blog
  • author image
      11 May, 2018 08:59

    thanks guys, i will upload more blogs on android soon......

  • author image
      11 May, 2018 00:36

    Thanks balu it really helps me in gaining some extra knowledge. please do more blog on such type so we can gain more . thanks once again for sharing your experience on android platform.

  • author image
      9 May, 2018 23:35

    Thanks Balu sir, for hard working and giving your valuable time for us, about these technology.. so please post more blogs related to android & its features(Version to version) also.

  • author image
      9 May, 2018 10:37

    hi friend...Congrats you done great job and thank u so much for sharing valuable information to us ......

Load More

No More Comments

Leave a Comment

Your comment has been posted and will appear soon.