Exercise 04 - Sum Calculator
Project name : E04 Sum Calculator
Introduction
The purpose of this exercise is to learn how to use Layout Editor and handle UI events. You will need to do an application, where end user can add numbers together - like a sum calculator. Remember check that your application UI is working with portrait and landscape orientations.
Example video
Look below example video to get a point what you need to do.
How to work
- Create a new project and name it to E04 Sum Calculator, select Kotlin language
- Remember save your project in your android-exercises folder
- Think what layout manager would work best for the buttons and use that one
- It is enough to get addition (sum) to work (or just a layout in landscape and portrait)
Small tips
- Add all the number buttons to call the same function
android:onClick="numberInput"
- You can get number from the pressed button with below code
1 2 3 4 5 |
|
1 2 |
|
- You might need a few class based variables to hold given number and sum
1 2 3 4 5 |
|
- And an event handling and logic for the +, = and c buttons
Problem with calculation?
If you don't get sum to work, you can return this exercise if both portrait and landscape layouts works correctly.
Test and push
Test your application in emulator, take screenshots and commit/push your project and screenshots back to JAMKIT/GitLab. Remember move your exercise/issue ticket from Doing to In Review in Issues Board and write your learning comments to issue comments.