Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
27 UI State in Jetpack Compose
Coda Pizza is off to a good start. In the last chapter, you built out a scrollable list, created a composable to act as the cell for toppings, and set up the screen’s layout, including an order button at the bottom of the page. But your app is missing something: Users cannot interact with it (other than scrolling the list of toppings). If users press a checkbox, it does not change from checked to unchecked or vice versa.
This is not what you are used to with framework views. Think back to CriminalIntent, where you used a CheckBox view to track whether a crime was solved. As soon as you added the checkbox to your UI, it responded to click events by toggling its state, with no additional code needed. ...
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