First Android App | Android Development | Java
Develop an android application to display “Hello World!” on screen
Introduction
In this tutorial, you learn how to start android development with the very first android project. You also create and run your first Android app Hello World, on emulator or physical device.
Before you start writing your first program using Android Studio, you have to make sure that you have set-up your Android development environment properly. Also it is assumed that you have a little bit of working knowledge with Android studio.
What you should already know
- Basic understanding of object-oriented programming
- Basic understanding of Java programming language
What you'll need
- A computer running Windows or Linux, or a Mac running macOS.
- Android Studio should be installed, if it’s not ready, please download it from the Official Website.
- Softwares: JDK, SDK and Android Studio
- Emulator: AVD Emulator
What you'll learn
- How to use Android Studio for building Android applications.
- How to create an Android project from a template.
- How to setup your mobile phone for testing android applications.
- How to test your first android application on a mobile phone.
What you'll do
- Create a simple Hello World app project in Android Studio.
- Configure the project.
- Explore the project layout.
- Explore the AndroidManifest.xml file.
- Run the Hello World app on the virtual or physical devices.
This application will have only one activity that will show a message that is "Hello World". In this android project, there will be two mandatory files that are
1. activity_main.xml This file is used for the layout of the application. In this file, we define the component layout of the user interface.
2. MainActivity.java: This MainActivity file helps us write the coding / functional part of the application.
To create this simplest Android application, just follow along with the steps in this tutorial.
Hello World Android Application
Create the App Project
Launch Android Studio, and you should see a welcome page, as shown below.

On the welcome page above, click Start a new Android Studio project. The next window presents the activities page, as shown below.
Android Studio provides activity templates to help you get started. For this Hello World project, choose Empty Activity and click Next.
Configure the Hello World Project Details
We'll finish creating the project by configuring some details about its name, package name, location, and the API version it uses.
- Enter "HelloWorldApp" in the Name field.
- Enter "com.example.helloworldapp" in the Package name field (Optional).
- If you'd like to place the project in a different folder, change its Save location.
- Select either Java or Kotlin from the Language drop-down menu.
- Select the lowest version of Android your app will support in the Minimum SDK field.
- If your app will require legacy library support, mark the Use legacy android.support libraries checkbox.
- Leave the other options as they are.
Click Finish.
The Gradle Build System
When you create a new application each time, Android Studio creates a folder for your projects and builds the project with its Gradle system. The Gradle process may take a few moments. Gradle is Android's build system, which is responsible for the compilation, testing, and deployment of code. It makes it possible for the app to run on the device.
Explaining the Files in an Android App Project
Whenever you start a new project, Android Studio creates the necessary folder structure and files for that app. Let's look at the different files involved in an Android app project.
The manifests Folder
The manifests folder contains the AndroidManifest.xml file. The manifest file describes essential information about your application.
The java Folder
This folder contains the Java source code files. As you can see from the editor window above, the MainActivity.java file contains the Java source code for the app's main Activity.
The res Folder
This folder includes all non-code resources, such as:
- layouts: Layouts are XML files that define the architecture for the UI in an Activity or a component of a UI. For example, in our application, the activity_main.xml file corresponds to the main Activity.
- values: Contains the color, style, and string XML files for the application.
- drawable: This is a catch-all for graphics that can be drawn on the screen, e.g. images.
- build.gradle: This is an auto-generated file which contains details of the app such as the SDK version, build tools version, application ID, and more.
Coding the Hello World App
Now you have a general view of the project structure, let's describe the hello world application.
The Default Main Activity
The main activity is the first screen that will appear when you launch your app.
Each Activity represents a screen of the Android app's user interface. Each Activity has a Java (or Kotlin) implementation file and an XML layout file.
The Default Main Activity Java Code
Below is the default Java code generated by the application for the main activity.
package com.example.helloworldapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
The Default Layout XML File
XML files are used for layouts. The main Activity layout XML file is found in the project's /app/src/main/res/layout directory. Layout files are named after what they represent. For example, the Hello World application has one layout, which is the activity_main.xml named after the main Activity.
Here is the default activity_main.xml layout. It contains one text view element, with the text Hello World!
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="https://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
As you can see, we don't need to change much to complete our Hello World app, but we'll make a small change so that the text stands out better—we'll change the text colour and font size.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:textSize="60dp"
android:textColor="#8a0240"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
The Strings File
The strings.xml file provides text strings for your application. For example, a default strings file looks like this:
<resources>
<string name="app_name">HelloWorldApp</string>
</resources>
If you want to change your app name, you can do it here.
The AndroidManifest.xml file
The AndroidManifest.xml file is a resource file which contains all the details needed by the android system about the application. It works as a bridge between the android developer and the android platform. It helps the developer to pass on functionality and requirements of our application to Android. This is an xml file which must be named as AndroidManifest.xml and placed at application root. Every Android app must have AndroidManifest.xml file. AndroidManifest.xml allows us to define, The packages, API, libraries needed for the application.
- Basic building blocks of application like activities, services and etc.
- Details about permissions.
- Set of classes needed before launch.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloworldapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Running the Application
Connect your Android device to your computer with a USB cable. You'll also need developer options enabled on your device. If this is not already enabled, follow these steps (this will work on most Android devices):
- Open up the Settings menu on your Android phone and scroll to the bottom.
- Tap About phone and scroll down again until you see the Build number option.
- Tap the Build number multiple times. Soon, you should see a pop-up that reads something similar to You are five taps away from being a developer.
- Keep tapping until the pop-up says you're a developer.
- Go back to the main Settings > System > Advanced. Developer options should be the second-last option. Turn the Developer options on.
In Android Studio, navigate to the top menu and select Run 'app'. Android Studio will show a dialog where you can choose which device to run your Android app on. Choose your connected device and click the OK button.
The Hello World application should now be running on your phone. From here, you can modify your app to whatever you want and add more features.
Summary
In this tutorial, we have discussed how to get started with a Hello World android app and run it in the android virtual device or mobile phone. After completing this tutorial you will get how to create your first Android app, you are on your way to a promising career in developing apps!
Thanks sir...
ReplyDeleteThanks you sir
ReplyDeleteMore valuable post!!! Thanks for sharing this great post with us.
ReplyDeleteJava training institute in chennai
learn java online
Java Training Institute in Coimbatore
This is good site and nice point of view.I learnt lots of useful information.
ReplyDeleteselenium training in tambaram
selenium training in velachery
selenium training in anna nagar
selenium training in t nagar
selenium training in OMR
selenium training in Chennai
ReplyDeleteThis blog is a great source of information which is very useful for me.
Software testing training in Tambaram
Software testing training in Anna Nagar
Software testing training in T Nagar
Software testing training in Porur
Software testing training in OMR
Software testing training in chennai
Great post. keep sharing such a worthy information
ReplyDeletecyber security course in bangalore
cyber security training in chennai
Great post. keep sharing such a worthy information
ReplyDeleteCloud Computing Training in Chennai
Cloud Training in Chennai
ReplyDeleteAwesome blog. Thanks for sharing this blog. Keep update like this...
Android Training in Bangalore
Android Classes in Pune
Android Classes in Hyderabad
Android Training in Gurgaon
Great blog!!! The information was more useful for us... Thanks for sharing with us...
ReplyDeleteSoftware Testing course
Dot Net online training
Android course in Chennai
Useful Blog ,Very useful to Visit Your page , Keep Updating More .
ReplyDeleteGerman Classes in Chennai
german classes in bangalore
Great post. keep sharing such a worthy information
ReplyDeleteFull stack developer course in chennai
Full stack developer course in bangalore
Great post. keep sharing such a worthy information
ReplyDeletePHP Course in Chennai
PHP Course in Bangalore
Informative blog... Thanks for sharing and keep updating
ReplyDeleteEthical Hacking Training in Chennai
Ethical Hacking course in Bangalore
Good Blog!! Keep sharing...
ReplyDeleteSEO Training in Bangalore
SEO Course in Bangalore
SEO Training Institute in Chennai
SEO Classes in Chennai
Best SEO Training in Chennai
Great post. keep sharing such a worthy information
ReplyDeleteDigital Marketing Training Institute in Chennai
Digital Marketing Training in Bangalore
Great post. keep sharing such a worthy information
ReplyDeleteDevOps course in Chennai
DevOps Course in Bangalore
Nice info!
ReplyDeleteRPA course in Chennai
Rpa training online
Your post is really good thanks for sharing these kind of post but if anyone looking for Best Consulting Firm for Fake Experience Certificate Providers in delhi, India with Complete Documents So Dreamsoft Consultancy is the Best Place.Further Details Here- 9599119376 or Visitwebsite-https://experiencecertificates.com/experience-certificate-provider-in-delhi.html
ReplyDeleteGreat Info, Your blog is very informative and interesting, I really liked while reading your article, the information you have mentioned in this post is really good. I am waiting for your upcoming post your ,post is really good . Otherwise if anyone want to Learn software testing course So Contact Us-9311002620 Or check my website- https://www.htsindia.com/Courses/ software testing / software -testing course
ReplyDeleteThose guidelines additionally worked to become a good way to
ReplyDeleterecognize that other people online have the identical fervor like mine to grasp great deal more around this condition.
white label website builder
website builder for reseller
I like your blog it is very knowledable and I got very usefull from your blog. Keep writing this type of blogs . If anyone want to get expercience in Delhi can contact me at - 9599119376 or can visit our website at
ReplyDeleteExperience Certificate In Delhi
Experience Certificate In Bangalore
Experience Certificate In Hyderabad
ReplyDeleteGreat Blog! very useful and informative keep updating like this.
DOT NET Training in Chennai
Dot Net Training Online
DOT NET Training in Bangalore
This comment has been removed by the author.
ReplyDeletePost is really impressive... Thanks for the data update and waiting for your new updates.
ReplyDeleteAndroid Training in Chennai
Android Online Training
Android Training in Coimbatore
Thank you for sharing this valuable information with us If anyone want to get experience in Delhi can contact me at - 9599119376 or can visit our website at
ReplyDeleteExperience Certificate In Delhi
Experience Certificate In Bangalore
Experience Certificate In Hyderabad
Experience Certificate In Noida
Thanks for taking your valuable time to share this awesome article with us. This is really informative. Looking forward to learn more from you.
ReplyDeleteCloud Computing Training in Chennai
Cloud Computing Online Training
Cloud Computing Course in Coimbatore
Happy to read this type of valuable content ,like the way of presenting your knowlege.If anyone want to get experience in Delhi can contact me at - 9599119376
ReplyDeleteExperience Certificate In Delhi
Experience Certificate In Bangalore
Experience Certificate In Hyderabad
Experience Certificate In Noida
I really appreciate your hard work you put into your blog and detailed information you provide. Further More Information About MIS training institute in Delhi Contact Here-+91-9311002620 Or Visit Website- https://www.htsindia.com/Courses/business-analytics/MIS-training-instiute-in-delhi
ReplyDeleteGreat Blog with Good Information.
ReplyDeleteRPA Certification Course
Robotics Process Automation Training in Chennai
Best RPA Training In Bangalore
Great Blog with Good Information.
ReplyDeleteSelenium Online Course
Selenium Training Institute in Chennai
Best Selenium Training in Bangalore
Great Blog with Good Information.
ReplyDeletePHP Certification Online
PHP Training in Chennai
PHP Training in Bangalore
Great job, this is essential information that is shared by you. This information is meaningful and very important for us to increase our knowledge about it. Always keep sharing this type of information. Thanks once again for sharing it. Android app development company in Bangalore
ReplyDeleteJubilant to read your blog. One of the best I have gone through. If anyone want to get experience certificate in Pune. Here the Dreamsoft is providing the genuine experience certificate in Pune. Dreamsoft is the 20 years old consultancy providing experience certificate in Pune. You can contact at the 9599119376 or can go to our website at https://experiencecertificates.com/experience-certificate-provider-in-pune.html
ReplyDeleteGreat blog with lots of information
ReplyDeleteBDD with Cucumber Online Training
Great Post!!! Thanks for the data update and waiting for your new updates.
ReplyDeletewhat does .net framework do
do i need .net framework
Wonderful article with great piece of information. Thanks for sharing this with us. I'll take reference from your blog. Do share more such informative articles.
ReplyDeleteImportance of Mobile App
Importance of Mobile Application
Great Blog with Good Information.
ReplyDeleteJava Online Course
JAVA Training in Chennai
Java Training in Bangalore
Nice Blog, it is very Impressive.
ReplyDeleteSelenium Training Online
Selenium Course in Chennai
Selenium Course in Bangalore
Great Blog with Good Information.
ReplyDeleteSoftware Testing Online Course
Software Testing Training in Chennai
Software Testing Course in Bangalore
Great blog.thanks for sharing such a useful information
ReplyDeleteSalesforce CRM Training in Chennai
This post is so interactive and informative.keep update more information...
ReplyDeletegraphic design courses in tambaram
graphic design courses in Chennai