Introduction to Android Applications in Kotlin
Since Google announced that Kotlin will be a first-class language for Android development, Kotlin has rapidly grown and surpassed Java as the language of choice for creating Android apps. Google has invested efforts into making Android applications faster, efficient, expressive, and easy to develop using Kotlin.
The Android Studio IDE provides full support for writing code in Kotlin. It also provides facilities to convert Java code to Kotlin syntax, in case you want to transition from existing Java code or bring over code snippets written in Java into your Kotlin code. When programming Android applications, you can benefit from the rich Android SDK, the Kotlin idiomatic style, Kotlin standard library, the Java JDK, and also advanced facilities like Coroutines.
In this chapter, we’ll implement the airport status example we saw in the previous chapters as an Android app. The application will ask the user to enter airport IATA codes. For each of the airport codes the user enters, the app will make asynchronous calls, using coroutines, to a remote web service to fetch the name of the airport, current temperature at that airport, and whether there’s a delay. The app will display these details in a table, in sorted order of airport names.
Even though the example we create in this chapter is relatively small, it’ll give you a pretty good idea of how to create Android apps using Kotlin and how to use coroutines to make asynchronous calls on Android devices. Get settled at your comfortable location—we’re ready to fire up the IDE and create an Android app.
Get hands-on with 1200+ tech skills courses.