Databases and RecyclerView

During the first part of this pathway, you create a database using the Room library and use coroutines to simplify asynchronous programming. During the second part of the pathway, you display a list of items with RecyclerView and make list items clickable. Throughout the pathway, you build up the TrackMySleep app, which allows users to rate their sleep quality and store their sleep data over time.


Create a Room database


Import the starter code for the TrackMySleep app. Then, use Room for data storage persistence in your Android apps. Room is a database library that's part of Android Jetpack. Room provides an abstraction layer over the underlying SQLite database by taking care of many of the chores of setting up and managing a database. With less boilerplate code, you can interact with the database more easily.

Use coroutines with Room


Use Kotlin coroutines to handle long-running tasks in your Android app elegantly and efficiently. Room has support for coroutines, so you refactor the app to use coroutines for asynchronous tasks like accessing and updating the database.

Use LiveData to control Button states


Extend the TrackMySleep app to collect a quality rating, add the rating to the database, and display the result. Use LiveData to trigger display of a snack bar and to enable or disable buttons.

RecyclerView Fundamentals


Import the next stage of the TrackMySleep app with some additional assets and utilities to help you with the rest of this pathway. Use a RecyclerView in your Android app to efficiently display a list of items.

DiffUtil and Data Binding with RecyclerView


Learn additional techniques that make RecyclerView more efficient for large lists, as well as making your code easier to maintain and extend for more complex UIs.

Grid Layout in RecyclerView


Replace the list of sleep data displayed by the RecyclerView in the TrackMySleep app with a grid layout of sleep data.

Interact with RecyclerView items


Make items in the RecyclerView clickable so that when an item is tapped, the user navigates to a detail screen.

Add headers in RecyclerView


Add headers to lists and grids in the TrackMySleep app.

Databases and RecyclerView quiz

Test your knowledge and earn your Databases and RecyclerView badge.