Android Date and Time Pickers edit

Date Picker Dialog

It is a dialog which prompts user to select date using DatePicker. The dialog requires context, initial year, month and day to show the dialog with starting date. When the user selects the date it callbacks via DatePickerDialog.OnDateSetListener.

public void showDatePicker(Context context,int initialYear, int initialMonth, int initialDay) {
       DatePickerDialog datePickerDialog = new DatePickerDialog(context,
                new DatePickerDialog.OnDateSetListener() {
                    public void onDateSet(DatePicker datepicker,int year ,int month, int day) {
                    //this condition is necessary to work properly on all android versions
                            //You now have the selected year, month and day

                }, initialYear, initialMonth , initialDay);

        //Call show() to simply show the dialog;


Please note that month is a int starting from 0 for January to 11 for December

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents
64 Menu
73 Date and Time Pickers
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close