Implementing the Activity

It’s time to implement the code for the UI, starting with the landing page, which is the main activity. We’ll first write the code to handle the airport code that the user enters into the text box and the button click. Then we’ll write the code to populate the RecyclerView with data obtained from the web service. That appears like a lot of work, but, surprisingly, we won’t need too much code to implement these actions. Let’s get started, one step at a time.

As the first step, let’s address head-on the need for coroutines in the UI. The UI will have to fetch the airport status from the web service, but we don’t want the UI to block and become inactive when the application is in the middle of network calls. To address ...

Get Programming Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.