Android Kotlin: Forecast App 03 – Local Database (Room Entity & Dao) – MVVM Tutorial Course

In the last episode we made a Retrofit service to fetch data from the weather API. We also used Gson to convert this data from JSON to Kotlin objects.

We could technically use only this Retrofit service and create a nice user interface to display all the data we are currently getting. Doing this wouldn’t be really performant and efficient though. What if the user doesn’t have an internet connection? Do we even really need to fetch data from the server every time the app is launched? Shouldn’t we cache all of this data?

The answer is YES! In this tutorial you are going to learn how to create a local SQLite database using the Room library. By the end of this tutorial, you will understand terms like entity or data access object (dao).

?Get the code from this tutorial?


Matej Rešetár

Matej is an app developer with a knack for teaching others. If he's not programming, making tutorials or doing other business, he's mostly working out, listening to audiobooks and taking cold showers.