Introduction
Ninety percent of people today use Android smartphones. In our day to day life, we perform mathematical operations with the help of a calculator. Thus, I will show you how to create a Calculator App for Android, using Android Studio. Android is the Kernel-based operating system. It allows the user, to modify GUI components and the source code.
Requirements
- Android Studio.
- Little bit XML and JAVA knowledge.
Download link (Android Studio): https://developer.android.com/studio/index.html.
Steps to be followed are given below
Carefully follow my steps to create a Calculator App for an Android and I have included the source code given below.
Step 1
Open an Android Studio. Start the new project.

Step 2
Put the Application name and company domain. If you wish to use C++ for coding the project, mark the Include C++ support, followed by clicking Next.

Step 3
Select the Android minimum SDK. Afterward, you chose the minimum SDK and it will show the approximate percentage of the people, who use SDK, followed by clicking Next.

Step 4
Choose the basic activity, followed by clicking Next.

Step 5
Put the activity name and layout name. Android Studio basically takes a Java class name, which is provided by you in the activity name

Step 6
Go to activity_calc.xml, followed by clicking the bottom text. This XML file contains the designing code for an Android app in the activity_calc.xml; copy and paste the code given below.
activity_calc.xml code
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/linearLayout1"
- android:layout_marginLeft="10pt"
- android:layout_marginRight="10pt"
- android:layout_marginTop="3pt">
- <EditText
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_marginRight="5pt"
- android:id="@+id/etNum1"
- android:layout_width="match_parent"
- android:inputType="numberDecimal">
- </EditText>
- <EditText
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_marginLeft="5pt"
- android:id="@+id/etNum2"
- android:layout_width="match_parent"
- android:inputType="numberDecimal">
- </EditText>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/linearLayout2"
- android:layout_marginTop="3pt"
- android:layout_marginLeft="5pt"
- android:layout_marginRight="5pt">
- <Button
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:text="+"
- android:textSize="15pt"
- android:id="@+id/btnAdd">
- </Button>
- <Button
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:text="-"
- android:textSize="15pt"
- android:id="@+id/btnSub">
- </Button>
- <Button
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:text="*"
- android:textSize="15pt"
- android:id="@+id/btnMult">
- </Button>
- <Button
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_weight="1"
- android:text="/"
- android:textSize="15pt"
- android:id="@+id/btnDiv">
- </Button>
- </LinearLayout>
- <TextView
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_marginLeft="5pt"
- android:layout_marginRight="5pt"
- android:textSize="12pt"
- android:layout_marginTop="3pt"
- android:id="@+id/tvResult"
- android:gravity="center_horizontal">
- </TextView>
- </LinearLayout>









Join the conversation! Your thoughts help the community grow.