2

I have datepickerdialog like this:

birthDateDialog = new DatePickerDialog(AddGrave.this, R.style.datePickerStyle, birthDateDialogListener, 
birthCalendar.get(Calendar.YEAR), 
birthCalendar.get(Calendar.MONTH), 
birthCalendar.get(Calendar.DAY_OF_MONTH));
birthDateDialog.show();

and style:

<style name="datePickerStyle" parent="AppTheme">
    <item name="android:endYear">2200</item>
    <item name="android:startYear">1000</item>
</style>

It works properly on android 4.x, but on android 2.2/2.3 range of the year is still 1900-2100. How can i change that range?

dudeck
  • 393
  • 5
  • 13

1 Answers1

1

Perhaps it is because setMaxDate and setMinDate were not introduced until API 11. These xml attributes might rely on these methods. I'm speculating here, since the documentation does not list a min API level for these xml attributes. Here is a workaround to setMaxDate programmatically.

Community
  • 1
  • 1
Mike Ortiz
  • 4,031
  • 4
  • 27
  • 54
  • But I need to do it with API < 11. So are there any suggestions? – dudeck Jan 07 '14 at 13:29
  • The link provided will work with API < 11. It just has to be done programmatically rather than in XML. – Mike Ortiz Jan 07 '14 at 13:40
  • All answers works only for set Min and Max date in range 1900-2100 in Android 2.x. I'm trying to use https://github.com/SimonVT/android-datepicker now. I'll know how it goes. – dudeck Jan 08 '14 at 09:56
  • This library (github.com/SimonVT/android-datepicker) won't works. Any other ideas? – dudeck Jan 08 '14 at 10:24
  • That's odd. Do they work for the native DatePicker? If so, there's an issue with that 3rd party library and you should file a bug so they can fix it. – Mike Ortiz Jan 09 '14 at 01:13