0

The DatePicker widget in Android has a range of possible values for each field (day, month, year). The minimum value can be set using the "android:startYear" attribute, the maximum value with "android:endYear".

But is the range of possible values device-specific? I mean, can you set the minimum value for the year to "0000" or are there any devices that don't support this value for a DatePicker's year field?

caw
  • 30,999
  • 61
  • 181
  • 291

3 Answers3

0

That's the kind of issues you get with android and they are hard to solve. I don't have the exact answer to your specific problem, and I doubt you can ever find reliable documentaion about this. However I did run into the same kind of issues and here are a few hints:

  • Go to the api javadoc, and look at the minimum api level on the right of the function/property description. You can use if and switch to check against the device version with android.os.Build.VERSION.SDK_INT.
  • Create several emulators with the different versions and test your code.
  • Buy several real devices.
  • Install a crash reporter such as acra, log exceptions remotely, fix them, and publish new versions.
Joel
  • 3,427
  • 5
  • 38
  • 60
0

We had a discussion here about datepicker. Actually, datepicker has a minimum and maximum value. For instance, by default for AOSP 2.3 it January 01, 1970. But you can correct this behavior as described in the discussion. Moreover, it seems that this problem is solved in new versions of Android. However, this feature can still be device specific so be careful!

Community
  • 1
  • 1
Yury
  • 20,618
  • 7
  • 58
  • 86
  • Thanks! But this is basically what I already mentioned in the question: Setting the minimum value with "android:startYear". – caw Mar 01 '12 at 01:36
  • But I've mentioned here and in the discussion that these values are device specific. So in the discussion there is an example that this value was changed. So, I guess the question is answered. – Yury Mar 01 '12 at 08:19
  • Ah, I see what you mean. The default value for "android:startYear" may be device-specific. But I would rather say it is API-level-specific. Because the source for DatePicker says the current default values are "1900" and "2100". But my question was if range of valid values for startYear is device-specific: So can I set the startYear to "0000" on all devices? Or are there devices that don't support this? – caw Mar 01 '12 at 13:27