0
Hello, everybody, all right? I wonder if it is possible, through the Datepickerdialog, to disable dates that users have chosen? Like, users choose a datepicker date that can no longer appear to other users, like in hair salons, which can’t have the same spot for two people. I got to the part of creating the Datepickerdialog, however, I do not know how to disable these dates after chosen by users.
diaAgendamento= (TextView) findViewById(R.id.textViewDataInicial);
diaAgendamento.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
int dia = calendar.get(Calendar.DAY_OF_MONTH);
int mes = calendar.get(Calendar.MONTH);
int ano = calendar.get(Calendar.YEAR);
DatePickerDialog dialog = new DatePickerDialog(MainActivity.this, android.R.style.Theme_Holo_Dialog_MinWidth, datePicker, dia, mes, ano);
dialog.show();
}
});
datePicker = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
month = month + 1;
String date = dayOfMonth + "/" + month + "/" + year;
diaAgendamento.setText(date);
}
};
Maybe it’s easier to use
setDisabledDays(Calendar[] days)
– ramaral
Thank you for your response. I have only one question: I’m putting Compile 'com.wdullaer:materialdatetimepicker:3.4.1' in my build.Radle and yet.
– Brian Moreira