I am having a weird issue with the Writeb4xobject function telling me the map isnt initialized when it is...
Here is my subroutine:
A screenshot which shows the line numbers.
Here is my error log:
the true is the log telling me the map is initialized, but clearly its not when it tries to write b4xobject
thoughts? Thanks.
Here is my subroutine:
B4X:
Sub WriteConfig
Dim R As RandomAccessFile
Dim AppSettings As Map
R.Initialize(File.DirInternal, "settingsv2.ini", False)
AppSettings.Initialize
AppSettings.Put("ConfigVersion", ConfigVersion)
AppSettings.Put("Brightnessval", CommEngine.Brightnessval)
AppSettings.Put("TeamName", ScoreEngine.TeamName)
AppSettings.Put("GameOptions", ScoreEngine.GameOptions)
AppSettings.Put("GameData", ScoreEngine.GameData)
AppSettings.Put("Baseball", ScoreEngine.Baseball)
AppSettings.Put("Soccer", ScoreEngine.Soccer)
AppSettings.Put("GameClock", ScoreEngine.GameClock)
Log(AppSettings.IsInitialized)
R.WriteB4XObject(AppSettings, 0)
R.Close
End Sub
A screenshot which shows the line numbers.
Here is my error log:
B4X:
true
Error occurred on line: 142 (Common)
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (Map).
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeType(B4XSerializator.java:285)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeObject(B4XSerializator.java:241)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeMap(B4XSerializator.java:256)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeObject(B4XSerializator.java:224)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.WriteObject(B4XSerializator.java:121)
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.WriteB4XObject(RandomAccessFile.java:326)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:265)
at md.vscbmultisport.common._writeconfig(common.java:296)
at md.vscbmultisport.main._activity_keypress(main.java:767)
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 md.vscbmultisport.main$HandleKeyDelayed.runDirectly(main.java:231)
at md.vscbmultisport.main$HandleKeyDelayed.run(main.java:228)
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:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: java.lang.RuntimeException: Object should first be initialized (Map).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeObject(B4XSerializator.java:159)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeMap(B4XSerializator.java:256)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.writeType(B4XSerializator.java:283)
... 27 more
** Activity (main) Pause, UserClosed = true **
the true is the log telling me the map is initialized, but clearly its not when it tries to write b4xobject
thoughts? Thanks.