Hello World! With Android Studio

Hello World! With Android Studio

Who am I

Hi There, I am Rishabh Kumar studied Computer Science and Engineering from IIT Ropar. I love to develop native android mobile apps. I have worked in many technology like Java, Android, MERN. I have been coding since 2014. Today i thought of starting a blog starting with my favourite Android Studio. Hope you guys will find it useful.

Getting Started

Video Explanation

Download Android Studio from official website

Install exe file just press next next.

Open Android Studio you will get following screen Click New Project

Screenshot 2022-01-09 151105.jpg

Select Empty Activity press next

Screenshot 2022-01-09 151618.jpg

You will get following screen with 5 fields

Screenshot 2022-01-09 152307.jpg

Name (Name of your application)
Package Name (Unique for every app on Play Store) contains 3 part like in this example com.hashnode.myapplication. first one typically com second part hashcode (your developer name unique on play store) this is your app myapplication. it gives you unique string id to identify you apps on app stores and in your mobile device.
Your drive location where your project will be saved.
Programming language it could be Java or Kotlin
Minimum Api / Android version you wanna support.

Click Finish you have your first Hello World App Ready

Untitled.png

Java Code Snippet

package com.hashnode.myapplication;

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);
    }
}

XML Layout & Code (xml help to create UI)

Untitled1.jpg

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".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>

Click avd manager icon to create a virtual device to run the application and launch avd.

Screenshot 2022-01-09 155047.jpg

Congratulations you just created your first app.

hello.jpg

Did you find this article valuable?

Support Rishabh Kumar by becoming a sponsor. Any amount is appreciated!