I posted this issue and since then I have reviewed all pertinent videos and there is no explanation why the following code should not work. I only need to understand why, if anybody can help.
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Type mytype (a As Int, b As Boolean, c As String)
Private gmapTest As Map
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
Private temp As mytype
Private obj As Object
Private map As Map
map.Initialize
temp.Initialize
temp.a = 1
temp.b = False
temp.c = "Hello"
map.Put( "key1", temp )
temp.a = 2
temp.b = True
temp.c = "World"
map.Put( "key2", temp )
obj = map.GetValueAt( 0 )
Private type1 As mytype = obj
fx.Msgbox( MainForm, type1, "")
File.WriteMap( File.DirApp, "testmap.txt", map )
'gmapTest.Initialize
gmapTest = File.ReadMap( File.DirApp, "testmap.txt" )
obj = gmapTest.GetValueAt( 0 )
Private type1 As mytype = obj
fx.Msgbox( MainForm,type1, "")
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True