Create a Tip Calculator App
Code for the Android Basics in Kotlin: Create a Tip Calculator app codelab.
In this codelab, you will be writing code for the tip calculator to go with the UI you created in the previous codelab, Create XML layouts for Android.
Prerequisites
- The code from the Create XML layouts for Android codelab.
- How to run an Android app from Android Studio in the emulator or on a device.
What you'll learn
- The basic structure of Android apps.
- How to read in values from the UI into your code and manipulate them.
- How to use view binding instead of
findViewById()
to more easily write code that interacts with views. - How to work with decimal numbers in Kotlin with the
Double
data type. - How to format numbers as currency.
- How to use string parameters to dynamically create strings.
- How to use
Logcat
in Android Studio to find problems in your app.
What you'll build
- A tip calculator app with a working
Calculate
button.
What you need
- A computer with Android Studio version 4.1 or higher installed.
- Starter code for the
Tip Time
app that contains the layout for a tip calculator.