How to set the next day depends on choosing the completed hour of today in timepicker?

时间:2016-10-20 12:38:46

标签: android timepicker

I am using a TimePicker.I need to choose 2 date pickup & dropdate. Here I validated both date & time.

If both the date is different, it is validated. But the pickup & drop date as same it is not validated.

case 1 : Not validate pickup date(current date&time) :2016-10-20 6:00 pm drop date :2016-10-20 04:25 pm

case 2 : Validate pickup date(current date&time) :2016-10-20 6:00 pm drop date :2016-10-24 04:25 pm

Here I need to hide / disable clicking of the previous hour of my current hour & min. How to do this?

1 个答案:

答案 0 :(得分:0)

  DatePickerDialog datePickerDialog  = new DatePickerDialog(this, 
   new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {

        }
    },2016,10,15);
    datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()+1000*60*60*24*5);
    datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis()-1000*60*60*24*5);
    datePickerDialog.show();