Setmindate() For Datepicker Doesn't Work
DatePicker datepicker = (DatePicker) view.findViewById(R.id.ad_date_picker); datepicker.setMinDate(Calendar.getInstance().getTimeInMillis()); It just doesn't work. It works only i
Solution 1:
P.S: Solution used to work before but might be outdated now.
Try something like this. If I understand correctly, you wish to set the minimum date of spinner to today's date. It works for me without giving any error:
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
long time = cal.getTimeInMillis();
DatePicker datepicker = (DatePicker) findViewById(R.id.datePicker);
datepicker.setMinDate(time);
In your xml I am supposing that you have something like this:
<DatePicker
android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Post a Comment for "Setmindate() For Datepicker Doesn't Work"