What is Jetpack Compose?
In past chapters, you learned how to set data into the Android View hierarchy and learned how to use different types of views for different purposes. That approach to user interface building is referred to as the imperative approach.
In the imperative approach, when we want to change the state of the user interface, we will need to manually change each user interface element until we reach the desired outcome.
Let’s assume that because of a user action, we want our TextView
to change the text and text color. This means that we would need to invoke setText
and setTextColor
to achieve our desired effect.
As an alternative to the imperative approach, we have the declarative approach, in which we would need to describe the final state that we want our user interface to reach, and internally, the required invocations would be performed.
This means that our TextView
would instead have the text and text color as attributes, and we could define different...