Category: Kotlin Android
-
An Android Studio Material Design 3 Theming and Dynamic Color Tutorial
This chapter will show you how to create a new Material Design 3 theme using the Material Theme Builder tool and integrate it into an Android Studio project. The tutorial will also demonstrate how to add support for and test dynamic theme colors to an app. Creating the ThemeDemo Project Select the New Project option…
-
Working with Material Design 3 Theming in Android Studio
The appearance of an Android app is intended to conform to a set of guidelines defined by Material Design. Google developed Material Design to provide a level of design consistency between different apps while also allowing app developers to include their own branding in terms of color, typography, and shape choices (a concept referred to…
-
An Android Studio In-App Purchasing Tutorial
In the previous chapter, we explored how to integrate in-app purchasing into an Android project and also looked at some code samples that can be used when working on your own projects. This chapter will put this theory into practice by creating an example project demonstrating how to add a consumable in-app product to an…
-
An Android Studio Biometric Tutorial
Touch sensors are now built into many Android devices to identify the user and provide access to the device and application functionality, such as in-app payment options using fingerprint recognition. Fingerprint recognition is just one of several authentication methods, including passwords, PINs, and, more recently, facial recognition. Although only a few Android devices currently on…
-
An Android SharedFlow Tutorial
The previous chapter introduced Kotlin flows and explored how these can be used to return multiple sequential values from within coroutine-based asynchronous code. In this tutorial, we will look at a more detailed flow implementation, this time using SharedFlow within a ViewModel. The tutorial will also demonstrate how to ensure that flow collection responds correctly…
-
Kotlin Flow Code Examples
The earlier chapter titled “An Introduction to Kotlin Coroutines” taught us about Kotlin Coroutines and explained how they can be used to perform multiple tasks concurrently without blocking the main thread. As we have seen, coroutine suspend functions are ideal for performing tasks that return a single result value. In this chapter, we will introduce…
-
An Android Kotlin Coroutines Tutorial
The previous chapter introduced the key concepts of performing asynchronous tasks within Android apps using Kotlin coroutines. This chapter will build on this knowledge to create an example app that launches thousands of coroutines at the touch of a button. Creating the Coroutine Example Application Select the New Project option from the welcome screen and,…
-
An Introduction to Kotlin Coroutines
The previous chapter introduced the concepts of threading on Android and explained how the user interface of an app runs on the main thread. To avoid degrading or interrupting user interface responsiveness, it is important that time-consuming tasks not block the execution of the main thread. One option, as outlined in the previous chapter, is…
-
Migrating from Material Design 2 to Material Design 3
This chapter will demonstrate how to migrate an Android Studio project from Material Design 2 to Material Design 3 and integrate a custom theme generated using the Material Theme Builder tool. Creating the ThemeMigration Project Select the New Project option from the welcome screen and, within the resulting new project dialog, choose the Empty Activity…
-
How to Add Android In-App Billing using Kotlin
In the early days of mobile applications for operating systems such as Android and iOS, the most common method for earning revenue was to charge an upfront fee to download and install the application. Another revenue opportunity was soon introduced in the form of embedding advertising within applications. Perhaps the most common and lucrative option…