Following pic is a web date picker. There, only between current date and previous 7 days are able to be selected.
I've to do this at Android using DatePickerDialog
. I implemented DatePickerDialog
on my EditText
's OnClickListener
as an example here.
The question is how to make user could not select out of that range? Any idea?
You can set minimum and maximum date.
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -7);
Date result = cal.getTime();
mDatePicker.setMaxDate(System.currentTimeMillis());
mDatePicker.setMinDate(result.getTime());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With