Android Question AS DatePickerTimeline Problem with MinDate option

fbritop

Active Member
Licensed User
Longtime User
I´ve been trying this new mode
Manual with CreateDatePicker.

I´m not sure I tried to dig in the code but I cound not figure out the logic.
ListMode is Paging
CreateMode is Manual
Lib Version: 1.19

Also is it possible to declare BodyColor and CurrentDateColor as part of then ASDatePickerTimeline_BodyProperties structure? I always manage in an internal way the either Dark or Light themes.

My code is:

B4X:
                pnl.LoadLayout("xDateTimeline")
                xDateTimeline.WeekNameShort=xDateTimeline.CreateASDatePickerTimeline_WeekNameShort("Lun", "Mar", "Mie", "Jue", "Vie", "Sáb", "Dom")
                xDateTimeline.MonthNameShort=xDateTimeline.CreateASDatePickerTimeline_MonthNameShort("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic")
                xDateTimeline.BodyProperties.DateTextColor=col.clrBlack
                xDateTimeline.BodyProperties.MonthTextColor=col.clrGray2
                xDateTimeline.BodyProperties.WeekDayTextColor=col.clrGray2
                'xDateTimeline.
                xDateTimeline.BodyProperties.WeekDayTextFont=xc.b4xFontNormal(xc.subTitleSize)
                xDateTimeline.BodyProperties.MonthTextFont=xc.b4xFontNormal(xc.subTitleSize)
                xDateTimeline.BodyProperties.DateTextFont=xc.b4xFontBlack(xc.TitleSize*1.2)
                xDateTimeline.SelectedDayProperties.Color=col.btnCalPickerSelected
               
                If startDate>0 Then
                    xDateTimeline.startDate=startDate
                Else
                    xDateTimeline.StartDate=xc.dtTodayTicks
                End If
                If maxDate>0 Then
                    xDateTimeline.MaxDate=maxDate
                    Log("maxDate:" & DateTime.Date(maxDate))
                End If
                If minDate>0 Then
                    xDateTimeline.MinDate=minDate '<------------- If I comment this there is no exception thrown
                    Log("minDate:" & DateTime.Date(minDate))
                End If
                xDateTimeline.CreateDatePicker

And it throws the following error

B4X:
Panel size is unknown. Layout may not be loaded correctly.
maxDate:22-11-2024
minDate:07-11-2024
xTimePicker_SelectedHourChanged
btnAction
btnAction
btnToday
setNavBarCustom
Error occurred on line: 402 (AS_DatePickerTimeline)
java.lang.IndexOutOfBoundsException: Index -4 out of bounds for length 16
    at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
    at java.util.Objects.checkIndex(Objects.java:359)
    at java.util.ArrayList.get(ArrayList.java:434)
    at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
    at b4a.example3.customlistview._getrawlistitem(customlistview.java:447)
    at cl.abreme.android.as_datepickertimeline$ResumableSub_AddWeeks.resume(as_datepickertimeline.java:1595)
    at cl.abreme.android.as_datepickertimeline._addweeks(as_datepickertimeline.java:1096)
    at cl.abreme.android.as_datepickertimeline._createdatepicker(as_datepickertimeline.java:451)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
    at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:224)
    at android.os.Looper.loop(Looper.java:318)
    at android.app.ActivityThread.main(ActivityThread.java:8765)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
(Exception) java.lang.Exception:  java.lang.IndexOutOfBoundsException: Index -4 out of bounds for length 16

Thanks
FBP
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…