Room basics – ViewModel

Reading Time: 5 minutes

In this chapter of the Room basics tutorial we are going to talk about how we can use the Room queries through a ViewModel. It means, we are going to call the queries from the ViewModel to follow the MVVM design pattern.

We can use the ViewModel as a communicator between the user interface and the repository. It holds the data in a lifecylce-conscious way, which survives configuration changes.


Read moreRoom basics – ViewModel

Follow and like us:

Room basics – DAO, Database and Entity

Reading Time: 7 minutes

In this chapter of the Room basics tutorial, we are going to talk about the main part of Room, which is the creation of the DAO, the Database and the Entity.

In short

      • DAO stands for Data Access Object, which is an interface, that contains the queries to access the database. It is annotated with @DAO
      • Database represents the database. Because it holds a connection to the SQLite database, all operations are executed through it. It is annotated with @Database.
      • Entity represents a table in the Room database, which should be annotatad with the @Entity keyword.

Read moreRoom basics – DAO, Database and Entity

Follow and like us:

Room basics – The starter project

Reading Time: 11 minutes

In this chapter of the Room basics tutorial we are going to create the starter project. It means, that we are going to add the needed dependencies, add the fragments, implement the RecyclerView, which will hold our todos, create the data class and finally we will create the navigation graph as well.

Because we will use in this tutorial Kotlin Coroutines, Navigaion– and Lifecycle components, we have to add to the project some other dependencies. Thenafter we can start to implement the RecyclerView for our todos.

So, let’s start coding! 😎

Read moreRoom basics – The starter project

Follow and like us:

Room basics – Introduction

Reading Time: 2 minutes

In this tutorial we are going to talk about how we can implement in our Android applications the Room persistent library. For this, we gonna create a whole new app. So, you can have a big picture about this library. In the introduction part we are going to summarize the tutorial.

Previously, if we wanted to store data locally on an Android device, we had to create manually the database helpers and the SQL queries. It took a long time and it wasn’t an easy task, because we could make many errors also, what what we got only at runtime.

Then Room come to the rescue. It was released in the Google I/O 2016. Room is one of Google’s architecture component library for working with SQLite on Android.

With the release of Version 2.1, the library added support for database transactions using coroutines.

Read moreRoom basics – Introduction

Follow and like us:

stay informed!

Subscribe to receive exclusive content and notifications