setMinDate(...) for DatePicker doesn't work when invoked a second time
This happens because method setMinDate() has check
if (mTempDate.get(Calendar.YEAR) == mMinDate.get(Calendar.YEAR)
&& mTempDate.get(Calendar.DAY_OF_YEAR) != mMinDate.get(Calendar.DAY_OF_YEAR){
return;
}
Simple workaround is to set min date with different year at first, for example
mPicker.setMinDate(0);
mPicker.setMinDate(new LocalDate().minusWeeks(2)
.toDateTimeAtStartOfDay().getMillis());
It works for me.
As said above, you can bypass the check by calling those before actually changing the value:
setMinDate(0);
setMaxDate(Long.MAX_VALUE);
If you want to reset the minimum or maximum value to its default, you can use the following values:
setMinDate(-2208902400000L); // Jan 1, 1900
setMaxDate(4102531200000L); // Jan 1, 2100