It seems logical that there should be some simple method to check which DatePicker object comes first but I can’t find done.
// so if you had two objects
final DatePicker start_datepicker = (DatePicker)findViewById(R.id.DatePickerStart);
final DatePicker end_datepicker = (DatePicker)findViewById(R.id.DatePickerEnd);
// I was thinking something along the lines of:
if (end_datepicker > start_datepicker) {
// something
}
// or is there something like
if (end_datepicker.isLarger(start_datepicker)) {
// Something
}
Is this possible or does anyone know of something simple along these lines to compare to dates?
A DatePicker is a UI widget for displaying a date. You don’t set it by assignment (as in your code) but by calling it’s
initmethod. Typically you would then track the date using an OnDateChangedListener. Nevertheless, you can compare the current dates displayed on two such widgets with something like this: