You are on page 1of 1

ROOM AND LIVE DATABASE:

* The architecture consists of UI controller, a viewmodel that serves as livedata,


a repository and a room database.
* The room database is backed by an SQLite database and accesible through a data
access object(DAO).
* The SQLite database stores the data which is needed.
* DAO maps the queries to functions which were defined in helper class.
* Room database uses the DAO to issue queries to SQLite database.
* The repository manages data sources.
* Viewmodel acts as communication center between repository and UI and hides
backend from UI.

Steps to implement room database:


Step 1: Add library and annotation processor to your app gradle file.
Step 2: Create an entity class.
Step 3: Create an DAO class.
Step 4: Create Database class.
Step 5: Create the Repository class.
* We have to implement CRUD operations using room.

You might also like