Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Composable Functions
Before you create the scrollable list of toppings, there is a bit of housekeeping to take care of. Right now, your entire UI is defined in your Activity. This can get unwieldy quickly, especially for large applications. You can break your UI into smaller chunks by refactoring your Compose code into functions.
Composables’ names, like Row and Column, begin with capital letters – just like the names of framework views like Button and ImageView. But composables are not classes, like views: They are functions.
Remember when we said you cannot get a reference to a Compose UI element or call findViewById on one? No classes means there is nothing that can be referenced. At runtime, with some help from the Compose ...
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