Below are the steps for Creating a Simple Android Application to Add Two Numbers
- STEP-1: First of all go to the xml file
- STEP-2: Now go to the text and write the code for adding 3 textview,2 textedit and Button and Assign ID to each component. Assign margin top, left, right for the location.
- STEP-3: Now, open up the activity java file.
- STEP-4: Declare few variables and the values entered in the Text Views can be read by using an id which we have set in the XML code above.
- STEP-5: Add the click listener to the Add button.
- STEP-6: When the Add button has been clicked, add the values and store it into the sum variable.
- STEP-7: To show the output in the result text view, set the sum in the textview.
Complete code of layout xml file and java file is given below.
After Complete layout xml file it will be shown as given below
Note: Similarly, Android App to subtract, multiply and divide numbers can be made by making minor changes in the Java and XML code.
- How to Publish Your Android App on Amazon App Store for Free?
- How to add Rate the App feature in Android
- How to add Lottie Animation in an Android app
- Android | Running your first Android app
- Introduction to Xamarin | A Software for Mobile App Development and App Creation
- Deploying Your Web App using Azure App Service
- Progressive Web App - A Combination of Native and Web App
- How Mobile App Testing Can Boost Chances of an App Success?
- Android | How to add Radio Buttons in an Android Application?
- How to Add OpenCV library into Android Application using Android Studio?
- GitHub App to Add or Remove Labels to Issues
- How to make a phone call from your Android App?
- Why Kotlin will replace Java for Android App Development
- App Development for Android in 2017: Challenges and Solutions
- Android | Creating a Calendar View app
- Adding Firebase to Android App
- How to change the color of Action Bar in an Android App?
- Android App Development Fundamentals for Beginners
- Android | Creating multiple Screen app
- Android & iOS App development using React Native with Expo
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vartika02