datepicker - Unable to set hide fututre date in Android -
i using higher api 11, here problem during hide future date:
@override protected dialog oncreatedialog(int id) { calendar c = calendar.getinstance(); int cyear = c.get(calendar.year); int cmonth = c.get(calendar.month); int cday = c.get(calendar.day_of_month); switch (id) { case date_dialog_id: datepickerdialog dialog = new datepickerdialog(this, mdatesetlistener, cyear, cmonth, cday); dialog.getdatepicker().setmaxdate(new date()); return dialog; /*return new datepickerdialog(this, mdatesetlistener, cyear, cmonth, cday);*/ } return null; }
i have problem: setmaxdate(new date());
i error:
the method setmaxdate(long) in type datepicker not applicable arguments (date)
so, please how hide future date .
from doc :
sets maximal date supported datepicker in milliseconds since january 1, 1970 00:00:00 in getdefault() time zone.
you can following :
dialog.getdatepicker().setmaxdate(new date().gettime());
Comments
Post a Comment