This is code to pop up when clicking EditText field with a date?
final DatePickerDialog.OnDateSetListener lastdateof = new DatePickerDialog.OnDateSetListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayOfMonth) {
String format = "dd MMMM yy";
calendar.set(calendar.YEAR, year);
calendar.set(calendar.MONTH, monthOfYear);
calendar.set(calendar.DAY_OF_MONTH, dayOfMonth);
datePicker.setMinDate(System.currentTimeMillis()-1000);
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
lastdate.setText(sdf.format(calendar.getTime()));
}
};
lastdate.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onClick(View view) {
new DatePickerDialog(AddActivity.this, lastdateof, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
how to disable or make not selectable of data picker date before current date?