|Android Architecture Components Reach Stability|
|Written by Kay Ewbank|
|Thursday, 09 November 2017|
Google has released the 1.0 stable version of its Android Architecture Components. These are a collection of libraries that Google says help you design robust, testable, and maintainable apps.
The Architecture Components are designed to help your apps deal with the aggressive resource management of the Android OS. Aggressive resource management enables Android OS to work on such a wide variety of devices, but it does make it harder to build robust apps.
When Google launched the Android Architecture Components at Google I/O, Mike James was dubious about how useful they would prove to be, saying:
"With turbulent times in the Android world, now is probably not the moment for an architecture library and certainly not an under-developed and probably under-resourced one."
A more upbeat analysis of the components can be seen in this video from Google:
The Architecture Components are made up of libraries for common tasks like lifecycle management and data persistence to help developers write modular apps with less boilerplate code.
Two of the component libraries - Room and Lifecyle - have now been launched in a 1.0 stable version.
Room is a SQLite object mapping library that can be used to convert SQLite table data to Java objects. It provides compile time checks of SQLite statements and can return RxJava, Flowable and LiveData observables.
Room has three main components - database, entity and DAO. Database contains the database holder and serves as the main access point for the underlying connection to your app's persisted, relational data. Entity represents a table within the database, and DAO contains the methods used for accessing the database.
The Lifecycle library provides tools for managing the state of components. It can be used to create lifecycle-aware components that manage their own lifecycles, reducing the possibility of leaks or crashes. The library provides classes and interfaces that let you build components that can automatically adjust their behavior based on the current lifecycle state of an activity or fragment.
Lifecycles are now also integrated with the Support Library, so you can use them with standard classes like AppCompatActivity.
The Lifecycle library is the foundation for other Architecture Components like LiveData, which is a lifecycle-aware observable that holds data and provides updates. The Lifecycle library is also the foundation for ViewModel, which separates ownership of view data and logic from lifecycle-bound entities like Activities and Fragments.
Other Architecture Components will become available in the coming months, probably starting with PagedList (which is currently in alpha). This is designed to handle large datasets better.
or email your comment to: email@example.com
|Last Updated ( Thursday, 09 November 2017 )|