makunomark
makunomark

Reputation: 809

Set date limit to CalendarDatePickerDialogFragment android

I'm using the better pickers library (here's the link) to select date in my application. I want to set limits to the picker such that the max date is today's date and the minimum date is not more than one year ago. Here's my code to display the CalendarDatePickerDialogFragment dialog;

private void showDateDialog() {
    FragmentManager fm = getSupportFragmentManager();
    DateTime now = DateTime.now();
    CalendarDatePickerDialogFragment calendarDatePickerDialogFragment = CalendarDatePickerDialogFragment
            .newInstance(this, now.getYear(), now.getMonthOfYear() - 1,
                    now.getDayOfMonth());
    calendarDatePickerDialogFragment.show(fm, FRAG_TAG_DATE_PICKER);
}

Upvotes: 0

Views: 342

Answers (1)

Related Questions