Tag Archives: Room

Room basics – ViewModel

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.

 

Continue reading Room basics – ViewModel

Follow and like us:

Room basics – DAO, Database and Entity

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.

Continue reading Room basics – DAO, Database and Entity

Follow and like us:

Room basics – The starter project

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! 😎

Continue reading Room basics – The starter project

Follow and like us:

Room basics – Introduction

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.

Continue reading Room basics – Introduction

Follow and like us: