From the course: Android Compose with Kotlin

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Handle loading and empty states

Handle loading and empty states - Kotlin Tutorial

From the course: Android Compose with Kotlin

Handle loading and empty states

- [Instructor] The session screen is almost complete. However, we want to add support for loading in empty states. It improves the user experience significantly as users avoid frustration and confusion when data is not available. We'll simulate a long network requests by adding a delay to the main view model. So right here, line number 43, I'm going to hit Enter. I'll use the delay function and let's delay it for, let's say two seconds. Okay. We can go ahead and deploy it to check our current behavior. All right, we see the day chips, and then the list of sessions comes in. So we'll start by adding a loading indicator to our session screen. So we'll move over to the session screen. And currently, it consists of a column with our list of sessions. Let's go ahead underneath where we've defined the list of sessions, and we'll add a new composable and let's call this one loading indicator. And we'll also make this a column. And what I'm going to do is have this fill the entire size…

Contents