yes, the month value is 0 based, so 12 is not valid. You would want to use 11.

Mike Child



On Tue, Dec 20, 2011 at 3:09 AM, Tomasz Cielecki <tom...@ostebaronen.dk> wrote:
> I just made a small sample here:
> https://github.com/Cheesebaron/MonoDroid.DatePickerSample
>
> But what your exception is saying that some of the values you have fed
> the DatePickerDialog are invalid:
> java.lang.IllegalArgumentException: current should be >= start and <= end
>
> I think it is the 12 you have put in for the month. Maybe it expects
> 11 as the months might be 0 indexed. Just like the sample shows
> date.Month - 1.
>
> On Tue, Dec 20, 2011 at 5:39 AM, Tom Opgenorth <t...@opgenorth.net> wrote:
>> Tutorial is fixed, but I'm getting an error when I try to use the
>> DatePickerDialog.  Basically, I have a button that when when clicked will
>> display the DatePickerDialog.  You pick your date, and then the date is
>> displayed as the text of the button. The exception occurs when you click on
>> the button, and the DatePickerDialog is about to be displayed.  Any
>> thoughts?
>>
>> Here is my OnCreateDialog:
>>
>>         protected override Dialog OnCreateDialog(int id)
>>
>>         {
>>
>>             try
>>
>>             {
>>
>>                 switch (id)
>>
>>                 {
>>
>>                     case DateDialogId:
>>
>>                         return new DatePickerDialog(this, OnDateSet, 2011,
>> 12, 01);
>>
>>                 }
>>
>>                 return null;
>>
>>             }
>>
>>             catch (Exception e)
>>
>>             {
>>
>>                 Console.WriteLine(e);
>>
>>                 return null;
>>
>>             }
>>
>>         }
>>
>> Ignore the try/catch, I was simply using it to help with sorting out the
>> exception. Drilling down through all the exceptions, this is the meat of the
>> exception:
>>
>> at Android.Runtime.JNIEnv.NewObject (IntPtr jclass, IntPtr jmethod,
>> Android.Runtime.JValue[] parms) [0x00030] in
>> /home/jpobst/Desktop/monodroid/Mono.Android/src/Runtime/JNIEnv.cs:406 \n  at
>> Android.App.DatePickerDialog..ctor (Android.Content.Context context,
>> IOnDateSetListener callBack, Int32 year, Int32 monthOfYear, Int32
>> dayOfMonth) [0x000e8] in
>> /home/jpobst/Desktop/monodroid/Mono.Android/platforms/android-8/src/generated/Android.App.DatePickerDialog.cs:174
>> \n  at Android.App.DatePickerDialog..ctor (Android.Content.Context context,
>> System.EventHandler`1 callBack, Int32 year, Int32 monthOfYear, Int32
>> dayOfMonth) [0x00000] in <filename unknown>:0 \n  at
>> net.opgenorth.m4a.mytrips.AddTripActivity.OnCreateDialog (Int32 id)
>> [0x0000e] in
>> U:\\work\\android\\mytrips.root\\dotnet\\net.opgenorth.m4a.mytrips\\net.opgenorth.m4a.mytrips\\AddTripActivity.cs:62
>> \n  --- End of managed exception stack trace
>> ---\njava.lang.IllegalArgumentException: current should be >= start and <=
>> end\n\tat
>> android.widget.NumberPicker.setCurrent(NumberPicker.java:288)\n\tat
>> android.widget.DatePicker.updateSpinners(DatePicker.java:362)\n\tat
>> android.widget.DatePicker.init(DatePicker.java:352)\n\tat
>> android.app.DatePickerDialog.<init>(DatePickerDialog.java:127)\n\tat
>> android.app.DatePickerDialog.<init>(DatePickerDialog.java:86)\n\tat
>> net.opgenorth.m4a.mytrips.AddTripActivity.n_onCreateDialog(Native
>> Method)\n\tat
>> net.opgenorth.m4a.mytrips.AddTripActivity.onCreateDialog(AddTripActivity.java:34)\n\tat
>> android.app.Activity.onCreateDialog(Activity.java:2482)\n\tat
>> android.app.Activity.createDialog(Activity.java:882)\n\tat
>> android.app.Activity.showDialog(Activity.java:2557)\n\tat
>> android.app.Activity.showDialog(Activity.java:2524)\n\tat
>> mono.android.view.View.OnClickListenerImplementor.n_onClick(Native
>> Method)\n\tat
>> mono.android.view.View.OnClickListenerImplementor.onClick(OnClickListenerImplementor.java:27)\n\tat
>> android.view.View.performClick(View.java:2485)\n\tat
>> android.view.View$PerformClick.run(View.java:9080)\n\tat
>> android.os.Handler.handleCallback(Handler.java:587)\n\tat
>> android.os.Handler.dispatchMessage(Handler.java:92)\n\tat
>> android.os.Looper.loop(Looper.java:123)\n\tat
>> android.app.ActivityThread.main(ActivityThread.java:3683)\n\tat
>> java.lang.reflect.Method.invokeNative(Native Method)\n\tat
>> java.lang.reflect.Method.invoke(Method.java:507)\n\tat
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)\n\tat
>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)\n\tat
>> dalvik.system.NativeStart.main(Native Method)\n
>>
>>
>> On Mon, Mar 28, 2011 at 14:51, Jonathan Pobst <mon...@jpobst.com> wrote:
>>>
>>> Tutorial should be fixed:
>>> http://mono-android.net/Tutorials/Hello_Views/Date_Picker
>>>
>>> Jonathan
>>>
>>> On 3/27/2011 3:51 AM, Liam wrote:
>>> > Hi
>>> >
>>> > Has anyone successfully implemented the DatePickerDialog? I see there
>>> > were a couple of emails about it in the mailing list a while ago.
>>> > The tutorial on the website is missing something when it comes to
>>> > implementing the create dialog method.
>>> >
>>> > If anyone knows of some working code out there or could let me know what
>>> > the tutorial is missing that would be much appreciated.
>>> >
>>> > Thanks
>>> > Liam
>>> > _______________________________________________
>>> > Monodroid mailing list
>>> > Monodroid@lists.ximian.com
>>> >
>>> > UNSUBSCRIBE INFORMATION:
>>> > http://lists.ximian.com/mailman/listinfo/monodroid
>>> >
>>> >
>>>
>>> _______________________________________________
>>> Monodroid mailing list
>>> Monodroid@lists.ximian.com
>>>
>>> UNSUBSCRIBE INFORMATION:
>>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>>
>>
>>
>> --
>> http://www.opgenorth.net
>>
>>
>> _______________________________________________
>> Monodroid mailing list
>> Monodroid@lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>
>
>
> --
> Med Venlig Hilsen / With Best Regards
> Tomasz Cielecki
> http://ostebaronen.dk
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to