Skip to content

Commit

Permalink
Fix crash on pre-Lollipop devices
Browse files Browse the repository at this point in the history
java.lang.IllegalArgumentException: fromDate does not precede toDate

Fixed by substracting a second:
http://stackoverflow.com/questions/13661788/how-to-set-minimum-datepicker-date-to-current-date
  • Loading branch information
dvdmunckhof committed Apr 7, 2015
1 parent 5177a14 commit 5392d3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

<activity
android:name=".ReservationActivity"
android:parentActivityName=".RestaurantActivity">
android:parentActivityName=".RestaurantActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".RestaurantActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void onDateSet(DatePicker datePicker, int year, int monthOfYear, int dayO
}
};
datePickerDialog = new DatePickerDialog(getActivity(), dateListener, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis());
datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);

TimePickerDialog.TimeChangedListener listener = new TimePickerDialog.TimeChangedListener() {
@Override
Expand Down

0 comments on commit 5392d3e

Please sign in to comment.