What are Android Architecture Components?
Android Architecture Components are a part of Android Jetpack .
As the Android Jetpack components are a collection of libraries that are individually adoptable and built to work together while taking advantage of Kotlin language features that make us more productive.
These software components have been arranged in 4 categories in which one of the categories is Architecture Components. Other categories are Foundation Components, Behavior Components and UI Components.
Android architecture components are a collection of libraries that help us in the following:
- Building the robust Android application.
- Building the testable Android application.
- Building the maintainable Android Apps.
Architecture components help in managing our UI component lifecycle and handling data persistence.
All the Android Architecture Components are as follows:
- Data Binding : It helps in declaratively binding UI elements to in our layout to data sources of our app.
- Lifecycles : It manages activity and fragment lifecycles of our app, survives configuration changes, avoids memory leaks and easily loads data into our UI.
- LiveData : It notifies views of any database changes. Use LiveData to build data objects that notify views when the underlying database changes.
- Navigation : It handles everything needed for in-app navigation in Android application.
- Paging : It helps in gradually loading information on demand from our data source.
- Room : It is a SQLite object mapping library. Use it to Avoid boilerplate code and easily convert SQLite table data to Java objects. Room provides compile time checks of SQLite statements and can return RxJava, Flowable and LiveData observables.
- ViewModel : It manages UI-related data in a lifecycle-conscious way. It stores UI-related data that isn't destroyed on app rotations.
- WorkManager : It manages every background jobs in Android with the circumstances we choose.
These are what the Android Architecture Components are.
What Next?
Here is a good video to watch on Android Architecture Components.
Now, its time to get started with the Android Architecture Components in our projects.
The best way to start with it is to try it on the codelab directly from Google.
Here is the link to the codelab.
What you'll learn
How to design and construct an app using the Architecture Components Room and Lifecycles libraries.
There are a lot of steps to using the Architecture Components and implementing the recommended architecture. The most important thing is to create a mental model of what is going on, and understand how the pieces fit together and how the data flows.
That's it. Thanks for reading.