Android DatePicker Date Limiting
问题 I am using DatePicket in my activity , I want to limit the date picked by user to todays date. They should not able to select date greater than todays date. thank you. 回答1: yes you can do it very easely the validation here is the exemple: if(dateObj1.before(dateObj2) || dateObj1.equals(dateObj2)){ //the program runs normally } else{ new AlertDialog.Builder(PM_Edit.this) .setTitle("Wrong Data Input!") .setMessage("The end Date must be Before the start Date, please insert new Date values")