i want disable past dates of date picker in android. can using
dialog.getdatepicker().setmindate(system.currenttimemillis() - 1000);
this working fine , past dates in date picker looks disabled. can still click on previous date , select it. how not let happen ? below screenshot of date picker :-
and here code disabling past dates :-
@override public dialog oncreatedialog(bundle savedinstancestate) { // use current date default date in picker final calendar c = calendar.getinstance(); int year = c.get(calendar.year); int month = c.get(calendar.month); int day = c.get(calendar.day_of_month); mactivity = new weakreference<createevent>( (createevent) getactivity()); datepickerdialog dialog = new datepickerdialog(getactivity(), this, year, month, day); if(callingview==fromdate){ dialog.getdatepicker().setmindate(system.currenttimemillis() - 1000); }else if (callingview==todate){ dialog.getdatepicker().setmindate(fromd); } // create new instance of datepickerdialog , return return dialog; }
got know comment bug in lollipop. so, fixed programatically.
all need check selected date min date set.
Comments
Post a Comment