All right, so let's have a look at what we're going to build.
You can see this little application here, which is called room demo, and it allows us to store data
permanently.
We're going to use room for that, which is part of Jetpack, which is a library that was introduced
for Android app development a couple of years ago and is now the best practice way of storing data.
So let's try this.
So let's say I have a name and an idea that I want to store in here.
So Dennis Dot, for example, and I add this record, so now I have this record, which will be there
permanently.
So even if I close my application and then I come back to it, the data will still be there.
If I now delete this data?
And I come back to the application after closing it.
The data will be gone as well.
So this is just a clean way of storing data permanently on your phone, which you will need for quite
some different types of applications.
So let's have a look at what room is and understand this a little better.
So basically.
Room allows us to save data in a local database.
It's part of the Android Jetpack Suite, which is a suite of libraries to help developers follow best
practices.
And it contains a bunch of different libraries, as you see here.
If you scrolled through it, there are many, many, many OK, and we're going to specifically use room
now.
The Room Persistence Library provides an abstraction layer oversexualized to allow fluent database access
while harnessing the full power of super light.
In particular, room provides the following benefits you can see here Compile time verification of SQL
queries convenience annotations that minimize repetitive and error prone boilerplate code and streamline
database migration paths.
So basically, it's building up on SQLite, which would have been the old fashioned approach of storing
data permanently on your Android device.
But it's basically just an layer on top, which allows us developers to do it in a safer fashion and
a lot more conveniently.
So let's look at a little presentation here that we've prepared.
So first of all, let's look at an introduction here.
Basically, saving information locally on a device is a very important feature for any Android application
uses.
Most of times would like to have their data available on the phone easily without needing to connect
to the internet, and the skylight database is provided in Android to make saving data locally possible.
But it involves quite a number of boilerplate code lines, so room is a jetpack library, as we saw
which it was created as a wrapper around secure light.
That makes it easy to write complex, equal statements to query the data you need without having to
go through every single column.
So let's look at the components of room.
So there are three components.
First of all, the entity, which is a data class that serves as the database table and will contain
variables to build out a column.
The class must be annotated with the added entity keyword and must have a variable that will serve as
primary key, which is denoted by the annotation primary key.
We're going to see what that means.
It's confusing to just see a word and a bunch of sentences following it.
We're going to specifically see how that is used in an actual example, as we've seen with the little
room demo.
So then we have the Dow, and the Dow is an acronym for Data Access Object and is an interface that
contains the necessary query to be performed for any of the operations required by the app.
There are available convenient methods like at Insert at Fetch and Update actually, and there is also
a query that allows you to write custom simple statements and also note that you must annotate the interface
with Adow.
And then we have the database.
This glass is annotated with at database and extends the room database.
It contains the database set up with the entity and serves as the main access point to the database
access point.
OK, so let's see all of this stuff in action in the next video.