Understand Jetpack Compose with Gajendra Singh Rathore

Member-only story

Getting started with Jetpack Compose

Gajendra Singh Rathore
3 min readMay 5, 2022

--

In this article we’ll learn about Jetpack Compose, a new declarative UI framework developed by Android team.

Follow me on GitHub

Table of contents:-

  1. What is Jetpack Compose?
  2. Why Jetpack Compose?
  3. What’s next?

What is Jetpack Compose?

Jetpack Compose is the new declarative UI framework developed by the Android team at Google. It’s a modern toolkit for building native Android UI. It simplifies and accelerates UI development on Android using very less code, tools support and Kotlin APIs.

Why Jetpack Compose?

Declarative

Jetpack Compose is a declarative UI framework, what does it mean? It means that we describe the view without relying on mutation and other traditional imperative programming concepts.

Let’s consider an example of enable/disable state of a button. In traditional approach, we’ll use findViewById() to get the reference of the view and then we’ll use setEnabled() on it to enable or disable the button.

But, in declarative UI, instead of describing the UI as enabled or disabled we just change the enable/disable state and re-run the code describing the UI.

So, no need to create/get a reference of the View after it’s created instead just re-run the code that created the View with different parameters based on requirements.

Independent

Jetpack Compose is completely independent from the operating system of the device. It’s not coupled to OS unlike traditional UI toolkit. This is one of the biggest advantage of Jetpack Compose for developers.
In traditional toolkit, in order to update the existing ImageView component, the new version of OS needs to be released in order to support the new ImageView and years later when most of the devices are on that new version of OS then only developers will be able to use the new ImageView component.

--

--

Gajendra Singh Rathore
Gajendra Singh Rathore

No responses yet

Write a response