Building Screens with Composables
You have seen a number of composables up to this point, with a range of complexity. On the simple end, you have seen atomic components like Row and Text. And you have built ToppingCell, a more complex composable that is built on top of other composables.
It is also possible to create a composable that renders the entire screen. In fact, the setContent function you called in MainActivity is a lambda that does just that. Because there are no limitations about what a single composable can do, you do not need another component like a Fragment to perform navigation. (You can, however, enlist the help of the AndroidX Navigation library, which has a Jetpack Compose flavor.)
Under Jetpack Compose, composables ...
Get Android Programming: The Big Nerd Ranch Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.