how i dissable my past dates in my code

  • Thread starter Thread starter AC Question
  • Start date Start date
A

AC Question

public static class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {

private int option;

@override
public Dialog onCreateDialog(Bundle savedInstanceState) {

Bundle args = getArguments();
option = args.getInt("index", 0);
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);

return new DatePickerDialog(getActivity(), this, year, month, day);
}

public void onDateSet(DatePicker view, int year, int month, int day) {
if (option == 1) {
edtStartDate.setText(year + "-" + (month + 1) + "-" + day);

} else if (option == 2) {
edtEndDate.setText(year + "-" + (month + 1) + "-" + day);
}
}
}