filmov
tv
Room Database , ViewModel , LiveData, RecyclerView (MVVM) || Android Architecture Component

Показать описание
#larntech #room #viewmodel #mvvm #livedata
Room Database , ViewModel , LiveData, RecyclerView (MVVM) || Android Architecture Component.
For additional help/customization and tasks reach me via.
Room Database is an architectural component that allows fluent database access in mobile applications.
Major Components in Room Database:
1. Database:
This is the main access point for the underlying connection to your app’s persistent relational data.
Usually annotated with @Database.
An abstract class that extends RoomDatabase.
It contains an abstract class that has no arguments which returns class annotated with @Dao.
It contains a list of entities.
2. Entity:
Represents tables in the database.
3. Dao:
It contains methods used to access the database.
We shall create an application which allows users to insert a new record and display the record using LiveData.
LiveData is an observable data holder class, it’s lifecycle aware meaning only updates app component observers that are only in an active lifecycle state.
We use LiveData in view model because of the following benefits.
Use of observers to only update UI when data actually changes instead of polling for changes
No database calls from ViewModel.
ViewModel extends AndroidViewModel class
ViewModel takes care of holding processing data needed for UI.
Thanks for watching if you are not subscribed. Kindly subscribe for more tutorials.
For additional help, feel free to comment below.
For personal assistance, you can reach me through.
Room Database , ViewModel , LiveData, RecyclerView (MVVM) || Android Architecture Component.
For additional help/customization and tasks reach me via.
Room Database is an architectural component that allows fluent database access in mobile applications.
Major Components in Room Database:
1. Database:
This is the main access point for the underlying connection to your app’s persistent relational data.
Usually annotated with @Database.
An abstract class that extends RoomDatabase.
It contains an abstract class that has no arguments which returns class annotated with @Dao.
It contains a list of entities.
2. Entity:
Represents tables in the database.
3. Dao:
It contains methods used to access the database.
We shall create an application which allows users to insert a new record and display the record using LiveData.
LiveData is an observable data holder class, it’s lifecycle aware meaning only updates app component observers that are only in an active lifecycle state.
We use LiveData in view model because of the following benefits.
Use of observers to only update UI when data actually changes instead of polling for changes
No database calls from ViewModel.
ViewModel extends AndroidViewModel class
ViewModel takes care of holding processing data needed for UI.
Thanks for watching if you are not subscribed. Kindly subscribe for more tutorials.
For additional help, feel free to comment below.
For personal assistance, you can reach me through.
Комментарии