First Application with Android4 min read


Hello everyone welcome to KnowledgeSuttra. In the previous blog we saw the introduction to Android Application development and Application component and some Additional Component to Build Android Application. In the previous blogs we just saw the theoretical things and from now we will start making Android Applications with the help of Android Studio. In the todays blog we will making our first Android Application. It our First Application so we will start with the very simple Application.

Working of Application

In our first Application we will do simple thing, we have to put name and it will return us Good Morning with the name which we entered. For example we enter name Akshay, it will return us Good Morning Akshay after clicking on button.

What we Need to make this Application?

To make Application we have too things

  • activity_main.xml

In the activity_main.xml we design our Application, we can design your application how it look. But we just make it simple we need one TextView to give title or heading and we require one EditText to enter the name and lastly we require one Button to click and run the task.

In the we will import the entire things which we need in activity_main.xml file.

Start making application!!

Step 1: –

Click on New Project

  • it will ask for Application name, give the name to your project.
  • Then it will ask Company domain, you have to put your domain if you have a website or server otherwise you can give it any name with .com
  • Then it ask project location it will take automatically but if you want to change the path you can give path hare and change it easily.
  • Don’t tick on Include c++ support and Include Kotlin support. Just click on Next Button.

Step 2: –

Now it showing Target Android Devices, in this you can choose for which device you want to develop application it give some options just like Phone and Tablet, Wear, TV, Android Auto, Android Things you can choose any of it. But we choose just Phone and Tablet. You have to set hare for which version your application will support, set their API 16: Android 4.1 (Jelly Bean).

Then click on Next Button.

Step 3: –

Now you have to select Activity, it will give you lots of options like Basic Activity, Bottom Navigation Activity, Empty Activity, and so on. We have to take Empty Activity for our Application.

Then click on Next Button.

Step 4: –

Now it will ask for Configure Activity you don’t have to do anything just click on Finish, and your project will start.

We will start with the xml file.

  • First of all we have to design our application, how it look like.
  • We have to select Layout first. Take ConstraintLayout (you also can use LinearLayout of type vertical). You can drag drop it or you can do it with xml coding.
  • We have to Drag TextView from the Palette and Drop it.
  • Click on Attributes which are placed on the Right corner of our project.
  • In the attributes you have to give one unique id to every attributes. I am giving it
  • Then give it Title as you want, I am giving Good Morning.
  • Now drag one EditText of type Plain Text. And drop it.
  • Do the same go to Attributes and give a unique id, I am giving In this don’t set ant Text, hare we are giving Hint it is also in Attributes. I am giving Enter your Name.
  • Now drag one Button to run our application, and drop it.
  • Do the same things again give it one unique id and give it text like ok, go, click, something like that. I am giving ok.

Hare we complete our design now it’s time for coding.

  • Go to
  • First of all we have to initialize all that things which we take in the xml file we take one Button, one EditText and one TextView.
  • We can do this by too different ways, we will see one way hare and other one in Next project.
final TextView txtName = (TextView)findViewById(;


    • Like the above code you can initialization and declaration on one time.
    • Like this code you can initialize remaining two attributes also just changing their name and id.
    • Now the important code start we have to fix one method with Button. setOnClickListener it means that this ,method will call when we click on the Button.
    • I am giving a sample code below.
btnText.setOnClickListener(new View.OnClickListener()
public void onClick(View view){ String name = btnText.getText().toString();
int age = Integer.parseInt(name); txtName.setText("good Morning, " + name); } }) ;
  • This is the code to give method to button.
  • In this method we are taking string (Name) in the EditText. And converting it into integer.
  • In the last code we marge good morning with the name.
  • Click on Run Button, green triangle like Button.
  • Run with emulator or external Device, I suggest go for the external device.
  • You just have to plug your phone with your system with the help of USB cable, and start debugging on your phone.

Hare we complete our coding part and you can run it now, i hope you get good result with this project if any problem will come you can ask me in the comment.


Please enter your comment!
Please enter your name here