Android Hello World Example | Android Hello World Run on Emulator

PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
JAVAEXCEPTIONSCOLLECTIONSSWINGJDBC
EXCEPTIONS
COLLECTIONS
SWING
JDBC
JAVA 8
SPRING
SPRING BOOT
HIBERNATE
PYTHON
PHP
JQUERY
PROGRAMMINGJava ExamplesC Examples
Java Examples
C Examples
C Tutorials
aws
In this tutorial, we will see our first Android Hello World application.
Technologies :
Android 6.0 (Marshmallow)
Android SDK 27
Android Studio 3.0.1
Gradle
Open Android studio and create Android Hello World project. Give project name, project location and click on next.
Recommended: How install Android Studio on Windows 10 Operating System.
Select Android API version, I am working on Android 6.0 (Marshmallow) and click on Next.
Select an Empty Activity, Hello World message will appear on this activity.
Give name to selected activity, as this is a main activity, I am giving the name as MainActivity and click on Finish.
Now It will create our first Android Hello World project like below structure.
Manifest: The is the Most Important File in Android as it contains all the Information about the app. It will act as a bridge between the application developer and android system.
Java: It contains all the .java files and classes where you actually code the backend of your app.
Res: This is the folder where it is mainly focused on front end and UI of the app

Drawable: This  folder holds images used for the app
Layout: This folder contains layout of the screen.
Values: Colors contains the Hex values of colors used in app.
Strings: It holds strings and app name
Styles: It contains style components of the app.

Drawable: This  folder holds images used for the app
Layout: This folder contains layout of the screen.
Values: Colors contains the Hex values of colors used in app.
Strings: It holds strings and app name
Styles: It contains style components of the app.
Gradle Scripts: It provides the components and libraries required for app
MainActivity.java
package onlinetutorialspoint.com.helloworld;

import android.support.v7.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);
    }
}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://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="onlinetutorialspoint.com.helloworld.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" />

</android.support.constraint.ConstraintLayout>

Run Application :
We can run the Android applications in 2 different modes.
Running on Android Emulator and
Running on Actual Device
Emulator is nothing an Android phone used for debugging and testing android apps. It’s more like an console where you see an output.
To run the application under Emulator mode, first we should configure the emulator.
Click on Run Button which you can see on Top Right of Toolbar, then Deployment Target wizard will open like below.
Create New Virtual Device :
Select any mobile, prefer selecting an 5.5 phone and then click on next.
Now you need to download the androd system image for your emulator, so recommended is select Nougat or Marshmallow  the download will be started.(it may take some time)
Click on Finish.
Now select the downloaded version of system image and click next.
Click on Finish to create a new virtual Device
Now when you click on Run again, you can find your newly created Virtual Device.
Select the Device and click OK.
Emulator may take some time to load and after successful gradle build you will see the output like this
Happy Learning 🙂

How to add Android Device to Android Studio
How to Configure Android Studio
Hello World Java Program Example
How to install Android Studio on Windows 10
How to install Android SDK Windows 10 Manual Process
Basic Android Login Form Example
Simple Spring Boot Example
How to Install Git windows 10 Operating System

How to add Android Device to Android Studio
How to Configure Android Studio
Hello World Java Program Example
How to install Android Studio on Windows 10
How to install Android SDK Windows 10 Manual Process
Basic Android Login Form Example
Simple Spring Boot Example
How to Install Git windows 10 Operating System