DatePicker dialog is a window that opens when the user presses the Change button. A custom dialog requires both a layout, which you have already created, and a class that contains the code that gives the dialog its behavior. Using a custom dialog in an activity also requires changes to the activity code. The following describes how to code the
DatePickerDialog class and make changes to the ContactActivity to display and use the dialog.
The first task is to create a new class to hold the custom dialog code. Right-click com.example.mycontactlist in the src folder and select New > Class from the pop-up menu. Enter
DatePickerDialog for the Name and click Finish. The new class opens with a limited amount of code. Replace ...