title: Android DatePickerDialog - fails with IllegalArgumentException
body: <p>Something odd that's happening on my Android emulator (Code and emulator run on API Level 10 - being Android 2.3.3): The current date on my emu is 22.08.2011 - if I initialize the DatePickerDialog with those settings (using the values from new Date() - which initializes the Date with the current date/time) then it fails, with the following exception:</p>
  
  <pre><code>08-22 02:14:23.731: ERROR/AndroidRuntime(3038): FATAL EXCEPTION: main
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038): java.lang.IllegalArgumentException: current should be &gt;= start and &lt;= end
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038):     at android.widget.NumberPicker.setCurrent(NumberPicker.java:288)
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038):     at android.widget.DatePicker.updateSpinners(DatePicker.java:357)
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038):     at android.widget.DatePicker.init(DatePicker.java:352)
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038):     at android.app.DatePickerDialog.&lt;init&gt;(DatePickerDialog.java:127)
  08-22 02:14:23.731: ERROR/AndroidRuntime(3038):     at android.app.DatePickerDialog.&lt;init&gt;(DatePickerDialog.java:86)
  </code></pre>
  
  <p>So I checked out the <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.3_r1/android/widget/DatePicker.java#DatePicker.updateSpinners%28%29" rel="nofollow">source Code for DatePicker</a> (For API lvl 2.3.3) and I checked the DatePicker code (because from the strack trace I knew it fails in the updateSpinners method) and at that line 357 (fourths line in the above stack trace) it calls mYearPicker.setCurrent(mYear); which made me think something must be wrong with my year. I logged the year I am passing - it's 2011 as expected. So I manually passed the year 2010 instead which worked - the DatePickerDialog showed up - initialized with the year 2010 (too bad, that I really need the current year - 2011 ;) ...).</p>
  
  <p>I am a bit at a loss as to what the reason is for this... The date on my emulator - as mentioned above - is correctly set to 22.08.2011 - my dev PC is set to the same date...</p>
  
  <p>Any clues/ideas as to where I am going wrong? To make things easier here is the code snippet where I am initializing the DatePickerDialog:</p>
  
  <pre><code>// Initializes a Date object with the current date and time for clarification:
  // it is actually declared as a private member variable of my class - 
  // just included it here so you guys know of which type dateTime ist
  
   Date dateTime = new Date();
   Button dateButton = new Button(context);
   dateButton.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  // dateSetListener is declared as well - but its code has no influence on the failure of 
  // the DatePickerDialog - to ensure this I commented all code in the dateSetListener's 
  // onDateSet method 
  
                  Dialog dateDialog = new DatePickerDialog(v.getContext(), dateSetListener, dateTime.getYear(),
                          dateTime.getMonth(), dateTime.getDay());
                  dateDialog.show();
              }
          });
  </code></pre>
  
  <p>Thanks in advance &amp; best regards,
  Ready4Android</p>