13 Dialogs

Dialogs demand attention and input from the user. They are useful for presenting a choice or important information. In this chapter, you will add a dialog in which users can change the date of a crime. Pressing the date button in CrimeFragment will present this dialog (Figure 13.1).

Figure 13.1  A dialog for picking the date of a crime

A dialog for picking the date of a crime

The dialog in Figure 13.1 is an instance of DatePickerDialog, a subclass of AlertDialog. DatePickerDialog displays a date selection prompt to the user and provides a listener interface you can implement to capture the selection. For creating more custom dialogs, AlertDialog ...

Get Android Programming: The Big Nerd Ranch Guide, 4th 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.