Introduction
Android is one of the most popular operating systems for mobile. In this article, I will show you how to create a Native Calculator Android application using Android Studio.
Requirements
- Android Studio version 2.3.3
- Little bit XML and JAVA knowledge.
- Android Emulator (or) Android mobile
- Download link (Android Studio)
Steps to be followed
The following steps are required to create a native Calculator Android application using Android Studio and I have included the source code below.
Step 1
Open Android Studio and start a new Android Studio Project.
Step 2

You can choose your application name and choose where your project is stored on the location. If you wish to use C++ for coding the project, mark the "Include C++ support", and click the "Next" button.
Now, select the version of Android and select the target Android devices.


Step 3
Now, add the activity and click the "Next" button.
Add Activity name and click the "Finish" button.


Step 4
Go to activity_main.xml, This XML file contains the designing code for an Android app in the activity_main.xml.
The XML code is given below.

- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_margin="20dp">
- <LinearLayout
- android:id="@+id/linearLayout1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="20dp">
- <EditText
- android:id="@+id/editText1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:inputType="numberDecimal"
- android:textSize="20sp" />
- <EditText
- android:id="@+id/editText2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:inputType="numberDecimal"
- android:textSize="20sp" />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/linearLayout2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="20dp">
- <Button
- android:id="@+id/Add"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="+"
- android:textSize="30sp"/>
- <Button
- android:id="@+id/Sub"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="-"
- android:textSize="30sp"/>
- <Button
- android:id="@+id/Mul"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="*"
- android:textSize="30sp"/>
- <Button
- android:id="@+id/Div"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="/"
- android:textSize="30sp"/>
- </LinearLayout>
- <TextView
- android:id="@+id/textView"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="50dp"
- android:text="The Answer is"
- android:textSize="30sp"
- android:gravity="center"/>
- </LinearLayout>








Prabakaran MPosted Aug 23, 2017, 4:58 AM
Nice thanks for sharing........keep it up shithik