Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Your First Dialog in Compose
There are several types of dialogs available in Compose, including an AlertDialog composable that mimics the appearance of its framework counterpart. You will be using Dialog, which is more agnostic about its content and will let you build a more custom UI. Regardless of which dialog flavor you choose, the semantics are largely the same – especially when it comes to how the dialog’s state is managed.
On its own, the Dialog function renders an empty window, so you will need to create a new composable that builds off of Dialog and provides the dialog’s view. Building this UI will require a fair amount of code, so your composable for this dialog should be in its own file to keep your code organized.
Create ...
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