I would like to have a multi-level type structure similar to:
Then the following works:
However the following compiles but results in a NullPointerException when run:
How best to resolve this?
B4X:
Sub Process_Globals
Type type1 (name As String, number As Int)
Type type2 (org As String, assoc As Int, person(100) As type1)
Type type3 (country As String, zip As Int, assoc(100) As type2)
Dim individual As type1
Dim company As type2
Dim nationality As type3
End Sub
Then the following works:
B4X:
Public Sub Show
If frm.IsInitialized = False Then
frm.Initialize("frm", 440, 520)
frm.RootPane.LoadLayout("Login")
company.Initialize
company.person(0).name = "ted"
company.person(0).number = 5
Log (company.person(0).name)
End If
frm.Show
End Sub
However the following compiles but results in a NullPointerException when run:
B4X:
Public Sub Show
If frm.IsInitialized = False Then
frm.Initialize("frm", 440, 520)
frm.RootPane.LoadLayout("Login")
nationality.Initialize
nationality.assoc(0).person(0).name = "ted"
nationality.assoc(0).person(0).number = 5
Log (nationality.assoc(0).person(0).name)
End If
frm.Show
End Sub
How best to resolve this?