Android studio is the official IDE (Integrated Development Environment) for the android operating system developed by Google. It is built on Jetbrain’s IJ (IntelliJ IDEA) software. In this android studio project, you will create a simple calculator android application using Android Studio.
Before getting started let’s look into some basics:
Mobile App Development Kit will be shipped to you and you can learn and build using tutorials. You can start for free today!
Software development kit: SDK is a set of tools that consists of an executable program which includes, frameworks, emulators, debuggers, documentation, profilers, libraries, etc. Android Studio already comes along with an Android SDK.
Editor and IDE: In general you can create an android app using a normal text editor like notepad++ but mostly IDE like the android studio is used. IDE makes it more user-friendly by combining all the SDK tools and helps to manage them easily.
Plugin - To automate project tasks libraries are used. Plugins are software add-on which is used to improve the abilities of the tool.
Advantages of Android Studio:
Want to develop practical skills on Mobile App Development? Checkout our latest projects and start learning for free
Project Implementation:
1. Let’s start by creating a new project from file>new project> and save it as a calculator.
2. Now select the minimum SDK as per your wish and click next.
3. Choose the empty activity module there are many activities available like Google map activity, login activity, scrolling activity, etc.
4. Now in the customize activity dialogue box leave the name as it is Main activity since we are going to have only one activity in our app. Click on Finish.
5. In App>res>layout>activity_mail.xml you can able to see app layout.
6. In our calculator app, we are going to have two text view, one is used to give the input by the user and other is to display the result. And four buttons are used in this app Addition, subtraction, multiplication and division.
7. We are going to use vertical layout so go-to text editor and type orientation= ”vertical”. Now the orientation has been set. Let’s work on the UI.
8. Add two text views and four buttons in the layout and change the ID for all the text views and buttons.
9. Change the text on the buttons using the editor. Type “textSize = 2sp” to change the size of the text.
10. Now go to Mainactivity.java and declare the following variables:
TextView result;
EditText number1, number 2;
Button add, subtract, divide, multiply;
11. Now write the actual program for the calculator. Refer the below example for add function:
num1 = Integer.parseInt{(number1,getText(),toString()};
num2 = Integer.parseInt{(number2.getText(),toString()};
result_num - num1 + num2;
result.setText(String.valueof(result_num));
Similarly write the code for subtraction, multiplication and division.
12. Click on Play and test the calculator app.
Skyfi Labs helps students learn practical skills by building real-world projects.
You can enrol with friends and receive kits at your doorstep
You can learn from experts, build working projects, showcase skills to the world and grab the best jobs.
Get started today!
Join 250,000+ students from 36+ countries & develop practical skills by building projects
Get kits shipped in 24 hours. Build using online tutorials.
Stay up-to-date and build projects on latest technologies