Search code examples
androidandroid-datepicker

How to set a date in DatePicker


I want DatePicker shows a specific date when opened, unfortunately seems I can set only the date limits with setMinDate and setMaxDate.

Is there a way to set a date without block the selection with date limits?


Solution

  • DatePicker date = new DatePicker(context);  
    date.init(year, month, day, null);
    

    where year, month and day are ints. Here is an explanation about init