I've implemented a DatePickerDialog
using the example shown here.
In my implementation of the DatePickerDialog.OnDateSetListener
I added validation logic to check that the selected date is within specific range.
private final DatePickerDialog.OnDateSetListener dateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int y, int m,
int d) {
final Calendar calendar = Calendar.getInstance();
calendar.set(y, m, d);
Date date = calendar.getTime();
if(!myValidationFunction(date)) {
// date not within allowed range
// cancel closing of dialog ?
}
}
};
The problem I have is that the DatePickerDialog
is closed automaticlly when the user clicks the set button and I want to keep the DatePickerDialog
open if the validate rule fails.
Does anyone know how to stop the DatePickerDialog
from closing when the user clicks the Set button?