Build your first Android App in Android Studio

Build your first Android App in Android Studio

Build your first Android App in Android Studio:

Hello beginners, Welcome to Approid Technologies coding world.

Today I am going to show you how you can start building your first Android App! 🙂

Coding is fun thing. Play with android tools and you will find it really awesome. Here are some tools for creating a development environment. I prefer Android studio as a best choice!

So Download Android Studio here. Once you have downloaded, follow this easy tutorial to install it correctly on you windows.

So we have all setup now! Great 🙂 Lets have some fun now!

 Step 1. Open your Android Studio & follow the screen shots.

After successfully creating your project in android studio, you will have to understand the application structure, Basically we have two areas

1- Design

2- Development

For Designing your app go to MyfirstApp/app/src/main/res/ location, you will see some xml format files inside your layout directory, One is called activity_main.xml is your application’s launching page.

For Developing your app go to MyfirstApp/app/src/main/java/ location & here you will find your java classes to add some functionality in you UI.

Go to activity_main inside MyfirstApp/app/src/main/res/layout & put these lines of code in it.

<RelativeLayout xmlns:android=""
    xmlns:tools="" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
        android:text="Hello World"
        android:layout_marginRight="222dp" />

This view has One button in it saying “Hello World” and has an id of named “button”.

Now go to MyfirstApp/app/src/main/java/ & put following lines of code in it.

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity {
    Button btnHelloWorld;
    protected void onCreate(Bundle savedInstanceState) {
        btnHelloWorld.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Toast.makeText(MainActivity.this,"Hello World from my First App ;)",Toast.LENGTH_LONG).show();
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(, menu);
        return true;
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        //noinspection SimplifiableIfStatement
        if (id == {
            return true;
        return super.onOptionsItemSelected(item);

In this set of code we are actually connecting the button from its id & add a click listener which instantiate when we click on a button and show a toast message!

That’s it we have done all for our first android app. Now Just click on the run button & add emulator or run it on your real android device, when you click on the button “Hello World” it will show a toast message!

Cheers you have successfully develop your first Android Application. 🙂

Comment below for any query.

Leave a Reply