Best Way to Make a Calculator

Table of Contents

Best Way to Make a Calculator

How You Can Make Calculator?

So experimentally Best Way to Make a Calculator and also make the launcher icon as you know how to use a calculator also you know it’s very easy to use and in every phone and its contain fist value, second value and include function like addition, subtraction, division now you can use your self created calculator and also share with your friends and family straightforwardly so follow step by step.

Why choose this project because its back end coding is too secure and also a beginner can understand easily.

Follow Steps

>>install Android Studio

>>Connect your Mobile Via USB Cable

>> Create Virtual Device Via AVD Manager

How Many Function will use in this App

>>>Activity Main Xml

Designing Work ,Front End Work

Best Way to Make a Calculator we will use four functions in the article because it made for beginner students so 

1st Add, Multiply, subtraction, divide.

Because after this startup, you can make your application a straightforward way so and it’s not tricky .in the first, we will design our app that how will look at our Calculator. so in first you can see in this pic 1st come constraint layout that replaces by LinearLayout and android.orientation=”vertical”. you have to set orientation vertical.

so its Best Way to Make a Calculator we will use a simple linear Layout because the benefit of linear layout that thing properly vertical come one by one that you can easily set. 

After that, set orientation and remove text from it.after that we will move to design.

Best Way To Make Calculator
Best Way To Make Calculator

The First Work to Making Application is to Need?

Suppose you are making an application for yourself or the company. First, you should work on design after that where the user will insert value and get an answer to it,its Best Way to Make a Calculator.


So in the first, we will use one image in his image we put on the logo of this always should choose one of right.

So can get a free image from that site will help you as a right in below click and get its Best Way to Make a Calculator.

                                      >Flat icon

Edit Views:

Then we will get two edit views, and users write to values in these edit views.

Text View:

We will get one text view because we understand the result in text view.becuase user give two value and get the result in text view.


Last, we will put four-button like Addition, Subtraction, Multiply, Division.

because after using two value then click on any button will get the result in text view.


Now we Implement these all things one by one for making a good calculator.

Paste your Image in Drawble Folder

Best way to make android app

Paste your image in the drawable folder because our all image save in this folder.

Image View:

in the first, we will image view drag and drop then adjust height and width in right corner everything layout about this pic so see in below

Best Way to Make Calculator

Uses Of edit text:

In this section, we will create two text value, so we write two number text. We will use edit number text because when user will write an amount, get number keyboard.

Best Way to Make Calculator

Text view:

For answer two value, we use a text view that will help with you with two value answer.

Best Way To Make Calculator

Add Button:

Now we will add four-button like Add, subtraction, multiply, divide.

Best Way to Make Calculator

>>Back End Work
>>Main Activity Java

Now we will work on the layout back end code here we will initialize all views then find views then after clicking on any button perform any function because we are two values and one text view, and four buttons.its Best Way to Make a Calculator.


First, we will go to main activity java after that we will Initialize views first we will get write in this edit text you can see that after writing you can see that its class import in java,

in java ending statement, we are use semicolon; we give every name with meaning full because when we call variable, then may we forget it and use the camel case.

First, we initialize seven things that we put in main activity because after initializing e can get its result so with arrangement write these like this

As you can see that in the its Best Way to Make a Calculator.

Best Way to Make Calculator

Call through id ,Find views By Id

Now we will call views through id so put always meaningful ids that you will access easily and its Best Way to Make a Calculator.

etFirstValue = findViewById(;
etSecondValue = findViewById(;
tvAns = findViewById(;
add = findViewById(;
subtract = findViewById(;
multiply = findViewById(;
divide = findViewById(;

Add clickner on Buttons

In this section we will make add Clickner on every button first select add Clickner then we have passed a new view, now we get a new function that is we add a feature that will show.its Best Way to Make a Calculator.

So for it, we have to convert to add sentence into a string after converting to the string we can convert an integer.

So now we will take three variables and their data type put as an integer.

That variable we will take as under 

int firstValue , secondValue , ans;

now we will convert edit text into integer one by one convert these variables so like because if convert into integer, they will perform the functionality of add, multiplication

firstValue = Integer.parseInt(etFirstValue.getText().toString());
secondValue = Integer.parseInt(etSecondValue.getText().toString());
ans = firstValue + secondValue;
tvAns.setText("Ans is = "+ans);

its applied ad clicker on add button same we will use all button. now we have completed our Calculator app.

Run App Via Android phone or Virtual device

Now you can run your application on your android device, and also you can create a virtual device for running application, and you can also upload your app on google play store for earning and also add mob.its Best Way to Make a Calculator.

Best Way To Make Calculator

More Android Development Visit

>>Android Develpoment

Be the first to comment

Leave a Reply

Your email address will not be published.