Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Mastering Kotlin for Android 14
  • Toc
  • feedback
Mastering Kotlin for Android 14

Mastering Kotlin for Android 14

By : Wangereka
5 (9)
close
Mastering Kotlin for Android 14

Mastering Kotlin for Android 14

5 (9)
By: Wangereka

Overview of this book

Written with the best practices, this book will help you master Kotlin and use its powerful language features, libraries, tools, and APIs to elevate your Android apps. As you progress, you'll use Jetpack Compose and Material Design 3 to build UIs for your app, explore how to architect and improve your app architecture, and use Jetpack Libraries like Room and DataStore to persist your data locally. Using a step-by-step approach, this book will teach you how to debug issues in your app, detect leaks, inspect network calls fired by your app, and inspect your Room database. You'll also add tests to your apps to detect and address code smells. Toward the end, you’ll learn how to publish apps to the Google Play Store and see how to automate the process of deploying consecutive releases using GitHub actions, as well as learn how to distribute test builds to Firebase App Distribution. Additionally, the book covers tips on how to increase user engagement. By the end of this Kotlin book, you’ll be able to develop market-ready apps, add tests to their codebase, address issues, and get them in front of the right audience.
Table of Contents (22 chapters)
close
1
Part 1: Building Your App
6
Part 2: Using Advanced Features
12
Part 3: Code Analysis and Tests
16
Part 4: Publishing Your App

Migrating from Java to Kotlin

Are you a Java developer and have your apps in Java? Are you wondering how you could get started with Kotlin? Worry not, this is your section. Kotlin offers two ways for you:

  • Java-to-Kotlin migration: The IDE that we are using, IntelliJ IDEA, has a tool for converting existing Java files to Kotlin.
  • Interoperability: Kotlin is highly interoperable with Java code, meaning you can have both Java and Kotlin code in the same project. You can continue using your favorite Java libraries in your Kotlin projects.

Let’s see how to migrate a sample Java class to Kotlin using IntelliJ IDEA:

  1. Inside src/main/kotlin, open the Song class, which has a number of Java functions.
  2. Right-click the file and you’ll see the Convert Java to Kotlin option at the bottom. Select this and you’ll be presented the following confirmation dialog:

Figure 1.4 – Confirmation dialog

Figure 1.4 – Confirmation dialog

At times after a conversion, you might need to make some corrections and that’s why we have this dialog. Click Yes to proceed and you’ll see your code is now in Kotlin. This is a useful feature that handles a major part of the conversion to Kotlin and you also learn about the syntax.

Now that we’ve learned how to migrate Java code to Kotlin, in the next section we will cover some of the features of Kotlin that make it useful for Android developers.

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete