Android Development: Creating a Basic Calculator




Welcome to a fun tutorial on making a basic calculator on an Android application. In this tutorial I will guide you through downloading all the necessary software, designing the layout of the application, coding the application to make it work properly, and finally how to run the application on an Android Virtual Device. 

Knowledge Requirements:
While creating the tutorial I assumed that the viewer already has a good understand of the JAVA language. In the tutorial I do not go into specific detail about the code I am writing besides a basic background of the new android parts. After watching many other Android tutorials however, I realized this is how many of the tutorial videos handle the JAVA knowledge.

Required Parts:
- Working Computer
- Windows / Mac / Linux OS
- Drive to learn
- Android Device (OPTIONAL)

If any questions arise during the 10 part video series, make sure to go to the final step in order to find my contact information that will allow me to personally address your question to provide you with a solution in a timely manor. 

I have attached the two files that we were coding with during these tutorials. If for any reason you get lost while following a long or can't figure out an error, these will be a good place to look since they contain the working code of the application.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Step 1: Download Java JDK

In this step I will guide you on how to install the Java JDK to your machine in order to correctly run the java code you will compile in later steps.

Step 2: Step 2: Download Android SDK

In this step I will go over how to download the Android SDK to provide you with the tools needed to develop your first Android Application. These tools include the AVD manager, the Eclipse development environment, and multiple plugins that will be used in the background.

Step 3: Step 3: Setting Up AVD (Android Virtual Device)

In this step I will go over how to set up a AVD (Android Virtual Device) in order to run your code on in future steps. Once you successfully create your AVD and it is starting up, I suggest moving onto the next steps since the boot time takes roughly 10 minutes. You will not need it booted up until step 10 so you will have plenty of time.

Step 4: Step 4: Setting Up Eclipse Environment

In this step I will go over how to set up the Eclipse development environment to get you started on programming your first Android application.

Step 5: Step 5: Creating Textviews for Layout

In this step I will go over how to design and set up the input and output textviews that you will be using in your Android Application.

Step 6: Step 6: Creating Buttons for Functionality

In this step I will go over how to create and design the buttons that you will use in your Android Application.

Step 7: Step 7: Setting Up the Main Activity Java File

In this step I will go over how to set up the main activity java file that you created in step 4. This code will be the background code for your program and will allow the buttons and textviews to function properly.

Step 8: Step 8: Making the Buttons Function Correctly

In this step I will dive further into the main activity java file to show you how to get the buttons to do the necessary calculations with the input values based on which button you pressed.

Step 9: Step 9: Outputting the Results

In this step I will finish off the main activity java file by outputting our results to a textview that we created in step 5.

Step 10: Step 10: Running the Application

In this final step I will go over how to run the completed Android application on the AVD that we set up in step 3. Once you have finished this step and successfully ran the application, you have completed your first Android tutorial!

Step 11: Conclusion & Contact

Thank you for following a long with my Basic Android Calculator tutorial. I hope you guys enjoyed the 10 part video series and learned a little more about development in Android. If you want to dive further into programming with Android I suggest thenewboston's tutorials on YouTube. This series provides over 200 tutorials starting from the most basic of programs, to more advanced and complex logic. 

After creating numerous tutorials and guides on Android Development I have learned that you can never prepare for an error that will arise when trying to make your first Android application. In order to accommodate for this, I have provided you with my email address so that you can email me with your problems.

Please include in the email:
- Your Name
- Tutorial Name
- Your Problem
- Screenshots of your problem

Send To:

When I receive this email, I will try and recreate your problem in order to help you solve it and get back to you within 5 days. Please allow for an additional 2 days before emailing me again with your problem due to my busy schedule at times. 

3 People Made This Project!


  • Instrument Contest

    Instrument Contest
  • Make it Glow Contest

    Make it Glow Contest
  • STEM Contest

    STEM Contest

16 Discussions


1 year ago

Thanks for the information


2 years ago

Here some other way for build android calculator......... copy paste and try ...!!

package com.example.deadhot.simplecalculator;import;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.EditText;import android.widget.Switch;import android.widget.TextView;public class MainActivity extends AppCompatActivity implements View.OnClickListener{ Button b1,b2,b3,b4; TextView tv1; EditText et1,et2; @Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } private void init() { b1=(Button) findViewById(; b2=(Button) findViewById(; b3=(Button) findViewById(; b4=(Button) findViewById(; tv1=(TextView) findViewById(; et1=(EditText) findViewById(; et2=(EditText) findViewById(; b1.setOnClickListener(this); b2.setOnClickListener(this); b3.setOnClickListener(this); b4.setOnClickListener(this); } @Overridepublic void onClick(View v) { String number1=et1.getText().toString(); String number2=et2.getText().toString(); switch (v.getId()){ case : int add=Integer.parseInt(number1)+Integer.parseInt(number2); tv1.setText(String.valueOf(add)); break; case int sub=Integer.parseInt(number1)-Integer.parseInt(number2); tv1.setText(String.valueOf(sub)); break; case int multi=Integer.parseInt(number1)*Integer.parseInt(number2); tv1.setText(String.valueOf(multi)); break; case try { int dev=Integer.parseInt(number1)/Integer.parseInt(number2); tv1.setText(String.valueOf(dev)); break; }catch (Exception e){ tv1.setText("Cannot Do"); } } }}


3 years ago

code download e nhi ho rha, q?


3 years ago

can u find how to build a calculator?


3 years ago

Helpful! Thanks.


3 years ago

it is very nice information but for beginners its difficult beginners ca alse visit


4 years ago

very nice information but for beginners its difficult beginners ca alse visit


4 years ago on Introduction

hi sir..need help from u!!!
how to create password in calculator. the method and step to create password to launching application. can u help me.. urgent please.. thank you


4 years ago on Introduction

we are going to implement a simple calculator App with basic functionality such as addition, subtraction, multiplication and division.

We need

1. Two EditText to enter our values(operands)

2. One Spinner to choose which operation to perform i.e. Addition, subtraction, Multiplication, Division. (spinner widget is used to implement drop-down list in android)

3. A button which will be clicked to perform the operation.

4. One more EditText widget to show the result

for full solution of the sample refer here:


5 years ago on Introduction

Hi. I have a problem in some parts of your tutorial.

Eclipse give a lot of errors, ex.:

layout cannot be resolved or is not a field.

How can I solve this problem? Thx


5 years ago on Introduction

very helpful tutorial. Neat clearly explained Thank you so much :)

Helped me a lot :)

Keep it up


5 years ago on Introduction

Best with 55+ Calculators

Play store -> AVL Visionary -> PUBLIC CALCULATOR


5 years ago on Introduction

m a Beginner for Android Development ri8 nw.
so can i get the some kind of project stuff which will be my project ....
i found it difficult to get the thing for android project

i kindly request you to provide me support and give some project URL's so that i can made it possible i.e android PROJECT for my curriculam