7.2.2. Custom DialogFragments

Several previous apps have used AlertDialogs in DialogFragments to display information to the user or to ask questions and receive responses from the user in the form of Button clicks. The AlertDialogs you’ve used so far were created using anonymous inner classes that extended DialogFragment and displayed only text and buttons. AlertDialogs may also contain custom Views. In this app, you’ll define three subclasses of DialogFragment:

ColorDialogFragment (Section 7.7) displays an AlertDialog with a custom View containing GUI components for previewing and selecting a new ARGB drawing color.

LineWidthDialogFragment (Section 7.8) displays an AlertDialog with a custom View containing GUI components for previewing and ...

Get Android™ How to Program, Second 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.