Title, I want to have a list (array, xml, text whatever is easiest) and I want to have only those dates(there are gaps in the dates) in the date picker be selectable. I know how to set the min and max date but nothing for certain dates.
my code so far
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
// Use the current date as the default date in the picker. val c = Calendar.getInstance() val year = c.get(Calendar.YEAR) val month = c.get(Calendar.MONTH) val day = c.get(Calendar.DAY_OF_MONTH)
val dialog = DatePickerDialog(requireContext(), this, year, month, day)
dialog.datePicker.maxDate = Date().time
return dialog
}
If there is a dialog.dataPicker.addDate or something similar I can work out the for loop for it but any pointers would help, Thanks.
Solution would be to create your own class for the datepicker dialog, you can extend the DatePickerDialog and implement your own logic there for handling certain date change events:
Hope this helps.