save data in a local database using room - PowerPoint PPT Presentation

About This Presentation
Title:

save data in a local database using room

Description:

in this presentation you can learn the how to save data in a local database using room. – PowerPoint PPT presentation

Number of Views:192

less

Transcript and Presenter's Notes

Title: save data in a local database using room


1
Save data in a local database using Room
  • Android training in Chandigarh

2
  • Room gives a abstraction layer over SQLite to
    permit familiar database get to while tackling
    the full intensity of SQLite.
  • Applications that handle non-minor measures of
    organized information can profit greatly from
    holding on that data locally. The most widely
    recognized use case is to reserve relevant pieces
    of data. That way, when the device can't get to
    the system, the user can in any case browse that
    content while they are offline. Any user
    initiated content changes are then matched up to
    the server after the device is back online.

3
There are 3 major components in Room
4
Database
  • Contains the database holder and servers as the
    fundamental passage for the hidden association
    with your application's persevered, relational
    data.
  • The class that is explained with _at_Database ought
    to fulfill the following conditions
  • Be a dynamic class that expands Room Database.
  • Include a list of organizations related to the
    database within the annotations.
  • Contain a dynamic strategy that has 0 contentions
    and returns the class that is annotated with
    _at_Dao.
  • At runtime, you can gain an instance of Database
    by calling Room.databaseBuilder() or Room.in
    Memory Database Builder().

5
Entity
  • Represents a table within the database.

Visit website- http//cbitss.in/android-training-i
n-chandigarh/
6

Contains the techniques utilized for getting to
the database. The application utilizes the Room
database to get the data access objects, or DAOs,
related with that database. The application at
that point utilizes each DAO to get entities from
the database and save any progressions to those
entities back to the database. At long last, the
application utilizes a entity to get and set
qualities that compare to table columns with in
the database.
DAO
7
The following code snippet contains a sample
database configuration with one unit and one DAO
Kotlin
JAVA
8
UserDao
kotlin
9
Java
10
App Database
Kotlin
JAVA
11
After creating the above files, you get an
example of the database created using the
following code
Kotlin
JAVA
12
  • Address- CBitss Technologies, sector 34A,
    SCO-23,24,25 Chandigarh 160022.
  • Mobile no- 9914641983
  • Click the link to know more about android-
    http//cbitss.co.in/blog/how-to-store-data-locally
    -in-the-android-app/

13
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com