Create a DatePickerDialog or TimePickerDialog
masterUse the static newInstance() method to create an instance of DatePickerDialog or TimePickerDialog. You must provide the context, default values (year, month, day for DatePicker), and the listener. Once created, call .show() to display the dialog.
Note: For the DatePickerDialog, it is recommended to use a PersianCalendar instance to provide the correct default Persian date values.
PersianCalendar persianCalendar = new PersianCalendar();
DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(
MainActivity.this,
persianCalendar.getPersianYear(),
persianCalendar.getPersianMonth(),
persianCalendar.getPersianDay()
);
datePickerDialog.show(getFragmentManager(), "Datepickerdialog");