Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Philosophies of State
Let’s start by discussing how framework views approach state. The apps you worked on earlier in this book actually had two representations of UI state. The first was built by you, generally defined with data classes and managed by ViewModels. This kind of state is often called application state or app state, because this state controls the behavior of your app as a whole and is how your app sees the world. Your Compose app will also have app state, and it will be defined similarly.
The second representation of UI state in framework views lived inside the Views themselves. Think about the framework CheckBox and EditText views. When the user presses a CheckBox or enters new text in an EditText, that input immediately ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access