Challenge: A Responsive DialogFragment

For a more involved challenge, modify the presentation of the DatePickerFragment.

The first stage of this challenge is to supply the DatePickerFragment’s view by overriding onCreateView instead of onCreateDialog. When setting up a DialogFragment in this way, your dialog will not be presented with the built-in title area and button area on the top and bottom of the dialog. You will need to create your own OK button in dialog_date.xml.

Once DatePickerFragment’s view is created in onCreateView, you can present DatePickerFragment as a dialog or embedded in an activity. For the second stage of this challenge, create a new subclass of SingleFragmentActivity and host DatePickerFragment in that activity. ...

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