Android Architecture Components: Introduction

This tutorial is an introduction to Android Architecture Components which will help us to understand why should we learn it.

What is Android Architecture Components ?

Android architecture components are a collection of libraries that help you design robust, testable, and maintainable apps. It is part of Android Jetpack.

Why to use Android Architecture Components ?

  • Building robust Android Application
  • Building testable android application
  • Reducing boilerplate code
  • Avoiding memory leaks using lifecycle aware components
  • Utilizing best practices of Android Application Development using ViewModel

Android Architecture Components are as follows:

Data Binding Library :

It is a support library that allows you to bind UI components in your layouts to data sources in your app using a declarative format.

For example below code calls findViewById() to find TextView widget and bind to the userName property of the viewModel

TextView textView = findViewById(;

Below code shows how easily we can do the same thing using Data Binding Library directly in the layout file. This removes the need to call any Java code.

<TextView android:text="@{viewmodel.userName}" />

Lifecycles :

It manages activity and fragment lifecycles of our app, survives configuration changes, avoids memory leaks and easily loads data into our UI.

Lifecycle-aware components perform actions in response to a change in the lifecycle status of another component, such as activities and fragments. These components help you produce better-organized, and lighter-weight code, that is easier to maintain.

LiveData :

It is an observable data holder class which is lifecycle-aware. Which means, it respect the lifecycle of other components such as activities, fragments or services.

This ensures that LiveData will only updates the component observers that are in an active lifecycle state. It will save the user from illegal state exception and memory leaks. UI will have always up to date data and no manual lifecycle handling required.

Navigation :

It handles everything needed for in-app navigation in Android application.It helps you implement navigation from simple button click to more complex patterns, such as app bars and navigation drawer. It also ensures a consistent and predictable user experience by adhering to an established set of navigation principles.

It consist of three parts :

  • Navigation graph : An XML resource that contains all navigation-related information in one centralized location. This includes all of the individual content areas within your app, called destinations, as well as the possible paths that a user can take through your app.
  • NavHost : An empty container that displays destinations from your navigation graph. The Navigation component contains a default NavHost implementation, NavHostFragment, that displays fragment destinations.
  • NavController : An object that manages app navigation within a NavHost. The NavControllerorchestrates the swapping of destination content in the NavHost as users move throughout your app.


The paging library helps in gradually loading information on demand from our data source.It helps you load and display small chunks of data at a time which reduces usage of network bandwidth and system resources.

Room :

It is a persistence library for Sqlite Database. It makes it easier to work with SQLiteDatabase objects in your app, decreasing the amount of boilerplate code and verifying SQL queries at compile time. So basically, Room makes using SQlite much easier for you by decreasing boilerplate code and adding compile time verification for SQL queries.

View Model :

It is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations. It also helps in memory leaks and making server API and database calls efficiently.

WorkManager :

WorkManager is an Android library that runs deferrable background work when the work’s constraints are satisfied. WorkManager is intended for tasks that require a guarantee that the system will run them even if the app exits. It provides us battery friendly way to perform background work which will be backward compatible to almost all devices available.

Stay tuned for more blog posts about Android Architecture Components topics as we continue this series. Have a question or something you’d like us to cover? Let us know in the comment section!

This article is a part of “Android Architecture Components”. Please do read next article on ViewModel.

2 thoughts on “Android Architecture Components: Introduction

  1. I have noticed you don’t monetize,
    don’t waste your traffic, you can earn additional bucks every month with new monetization method.
    This is the best adsense alternative for any type of
    website (they approve all sites), for more info simply search in gooogle: murgrabia’s tools


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.