Android Programming: The Big Nerd Ranch Guide, 5th Edition
by Bryan Sills, Brian Gardner, Kristin Marsicano, Chris Stewart
Sending Results from a Dialog
Your final task is to wire up all the buttons in your dialog so they can correctly update the user’s pizza. Currently, the options in this dialog do nothing more than offer confirmation that they were, in fact, pressed.
Each of the options in this dialog should do two things when pressed: It should notify the creator of the dialog which choice was selected, and it should dismiss the dialog. You already have everything you need to make the options dismiss the dialog. The onDismissRequest callback can be reused after selecting an option to indicate that the dialog is requesting to be dismissed.
Update your two empty onClick callbacks with this behavior.
Listing 28.10 Dismissing the dialog (ToppingPlacementDialog.kt ...
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