I have tried just about everything and I can not figure out how to edit the Time value.
No problem setting a default value in btnAdd sub:
And it works fine with those defaults set.
But when I try to edit the data, (Called from btnEdit_Click) the programme crashes when it gets to this line in the Sub ShowDialog(Item, RowId):
No problem setting a default value in btnAdd sub:
B4X:
Sub btnAdd_Click
Dim m As Map = CreateMap()
m.Initialize
m.Put("Type","Delivery")
m.Put("ONum","")
m.Put("Address","")
m.Put("Phone","613-")
lperiod.Hours = DateTime.GetHour(DateTime.Now)
lperiod.Minutes = DateTime.GetMinute(DateTime.Now)
m.Put("Time",lperiod)
ShowDialog(Item, RowId)
But when I try to edit the data, (Called from btnEdit_Click) the programme crashes when it gets to this line in the Sub ShowDialog(Item, RowId):
B4X:
Wait For (PrefDialog.ShowDialog(Item, "OK", "CANCEL")) Complete (Result As Int)
B4X:
Error log:
Error occurred on line: 359 (PreferencesDialog)
java.lang.ClassCastException: java.lang.String cannot be cast to b4a.example.dateutils$_period
at sef.LPDelivery.preferencesdialog._filldata(preferencesdialog.java:2267)
at sef.LPDelivery.preferencesdialog$ResumableSub_ShowDialog.resume(preferencesdialog.java:583)
at sef.LPDelivery.preferencesdialog._showdialog(preferencesdialog.java:405)
at sef.LPDelivery.editabletable$ResumableSub_ShowDialog.resume(editabletable.java:926)
at sef.LPDelivery.editabletable._showdialog(editabletable.java:892)
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:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6302)
at android.view.View$PerformClick.run(View.java:24908)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6558)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)