Architecture Components( Part of Android Jetpack) at Google I/O to provide guidance on app architecture, with libraries for common tasks like lifecycle management and data persistence.
Architecture Components provide a simple, flexible and practical approach that frees developers from some common problems so they can focus on building great experiences. This is based on core building blocks tied together by guidance on app architecture.
Lifecycles:
Every Android developer has to deal with the operating system starting, stopping and destroying their Activities. That means managing the state of components - such as observables used to update UI - as you move through the lifecycle. Lifecycles enable the creation of lifecycle-aware components that manage their own lifecycles, reducing the possibility of leaks or crashes. The Lifecycle library is the foundation for other Architecture Components like LiveData.
LiveData:
LiveData is a lifecycle-aware observable that holds data and provides updates. Your UI code subscribes to changes and provides LiveData a reference to its Lifecycle. Because LiveData is lifecycle-aware, it provides updates when its Lifecycle is started or resumed but stops providing updates when the LifecycleOwner is destroyed. LiveData is a simple way to build reactive UIs that are safer and more performant.
ViewModel:
ViewModel separates ownership of view data and logic from lifecycle-bound entities like Activities and Fragments. A ViewModel is retained until its associated Activity or Fragment is disposed of forever - that means to view data survive events like a Fragment being recreated due to the rotation. ViewModels not only eliminate common lifecycle issues, but they also help build UIs that are more modular and easier to test.
Room:
Nearly all apps need to store data locally. While Android has bundled SQLite with the platform since version 1, using it directly can be painful. The room is a simple object-mapping layer that provides the full power of SQLite with less boilerplate. Features like compile-time query verification and built-in migration make it easier to build a robust persistence layer, while integration with LiveData lets Room provide database-backed, lifecycle-aware observables. Room blends of simplicity, power, and robustness for managing local storage, and we hope you give it a try.
What’s new with Room?
The room is not a new database it just provides an abstraction layer over the existing SQLite database which is available since from Android 1.0 but the new features that it provides are the way to store, retrieve and modify data to the database. It also offers to compile-time check for the table name, column name and live monitoring for database changes using LiveData.
Source Code
Please let me know your review on this.
Architecture Components provide a simple, flexible and practical approach that frees developers from some common problems so they can focus on building great experiences. This is based on core building blocks tied together by guidance on app architecture.
Lifecycles:
Every Android developer has to deal with the operating system starting, stopping and destroying their Activities. That means managing the state of components - such as observables used to update UI - as you move through the lifecycle. Lifecycles enable the creation of lifecycle-aware components that manage their own lifecycles, reducing the possibility of leaks or crashes. The Lifecycle library is the foundation for other Architecture Components like LiveData.
LiveData:
LiveData is a lifecycle-aware observable that holds data and provides updates. Your UI code subscribes to changes and provides LiveData a reference to its Lifecycle. Because LiveData is lifecycle-aware, it provides updates when its Lifecycle is started or resumed but stops providing updates when the LifecycleOwner is destroyed. LiveData is a simple way to build reactive UIs that are safer and more performant.
ViewModel:
ViewModel separates ownership of view data and logic from lifecycle-bound entities like Activities and Fragments. A ViewModel is retained until its associated Activity or Fragment is disposed of forever - that means to view data survive events like a Fragment being recreated due to the rotation. ViewModels not only eliminate common lifecycle issues, but they also help build UIs that are more modular and easier to test.
Room:
Nearly all apps need to store data locally. While Android has bundled SQLite with the platform since version 1, using it directly can be painful. The room is a simple object-mapping layer that provides the full power of SQLite with less boilerplate. Features like compile-time query verification and built-in migration make it easier to build a robust persistence layer, while integration with LiveData lets Room provide database-backed, lifecycle-aware observables. Room blends of simplicity, power, and robustness for managing local storage, and we hope you give it a try.
What’s new with Room?
The room is not a new database it just provides an abstraction layer over the existing SQLite database which is available since from Android 1.0 but the new features that it provides are the way to store, retrieve and modify data to the database. It also offers to compile-time check for the table name, column name and live monitoring for database changes using LiveData.
Source Code
Please let me know your review on this.
18 comments
Click here for commentsNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyNo more live link in this comments field
ReplyConversionConversion EmoticonEmoticon