I know that usually when program crashes it should tell you the line where it crashed. But in my case it's not very relevant. Here's what I mean.
My layout just appears as a single checkbox:
I will use Statemanager to save a setting , and the checkbox should set its value from the setting.
Then it will crash with this error:
Not only it doesn't say what line (in Main) it crashed , but it also doesn't specify which exactly can't parse as boolean.
If I had many like this then it wouldn't be convenient.
So I would like it if it had something like this:
My layout just appears as a single checkbox:
I will use Statemanager to save a setting , and the checkbox should set its value from the setting.
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
StateManager.SetSetting("hello",1)
CheckBox1.Checked = StateManager.GetSetting("hello")
End Sub
Then it will crash with this error:
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 24 (StateManager)
java.lang.RuntimeException: Cannot parse: 1 as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:612)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:682)
at b4a.example.main._activity_create(main.java:390)
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 b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6186)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
** Activity (main) Resume **
Not only it doesn't say what line (in Main) it crashed , but it also doesn't specify which exactly can't parse as boolean.
If I had many like this then it wouldn't be convenient.
So I would like it if it had something like this:
Error occurred on line: 6 (Main) from line: 24 (StateManager)
java.lang.RuntimeException: Cannot parse: Statemanager.getSetting("hello") = 1 as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:612)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:682)
at b4a.example.main._activity_create(main.java:390)
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 b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6186)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
** Activity (main) Resume **
Last edited: