android - How to restrict user from choosing past dates from date picker? -


i using date picker set alarm allowing user set dates before current date here code set date picker

public void onclick(view v) {              new datepickerdialog(reminderdetailactivity.this, date,                     mycalendar.get(calendar.year), mycalendar                             .get(calendar.month), mycalendar                             .get(calendar.day_of_month)).show();          } 

can tell me hoe restrict user going past dates

thank in advance

you use this.

calendar c = calendar.getinstance(); int todaysdate = c.get(calendar.date);   public void onclick(view v) {              new datepickerdialog(reminderdetailactivity.this, date,                     mycalendar.get(calendar.year), mycalendar                             .get(calendar.month), mycalendar                             .get(calendar.day_of_month)).show();                           if(todaysdate < date){                     toast.maketext(activity.this, "choose future date",toast.length_short).show();     }else{                     //execute normal function     }      } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -