I tried a lot,but all doesn\'t work.
I need my date picker the date starts with september 1 2014.But it starts 1900. I set minimum date concept it disappears all past da
You can set by this code:
Calendar cal=Calendar.getInstance(Locale.ENGLISH);
datePickerDialog .init(cal.getTime().getYear()+1900, cal.getTime().getMonth(), cal.getTime().getDay(), this);
EDIT
To set Minimum date to your DatePicker
you can set it by using :
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
which sets today's date as minimum date and all the past dates are disabled.
Note: setMinDate was introduced in API 11
EDIT #2
You need to create custom DatePickerDialog
for that :
class DatePickerDialog1964 extends DatePickerDialog {
DatePickerDialog1964(Context c) {
super(c, null, 2014, 1, 1);
@SuppressWarnings("deprecation")
Date min = new Date(2014-1900, 1, 1);
DatePicker p = getDatePicker();
CalendarView cv = p.getCalendarView(); // should check for null
long cur = cv.getDate();
int d = cv.getFirstDayOfWeek();
p.setMinDate(min.getTime());
cv.setDate(cur + 1000L*60*60*24*40);
cv.setFirstDayOfWeek((d + 1) % 7);
cv.setDate(cur);
cv.setFirstDayOfWeek(d);
}
}
To use this :
new DatePickerDialog1964(context).show();