Sub Process_Globals
Type UserDetails(username As String, password As String, loginOk As Boolean, firstname As String, lastname As String, email As String, players As List, courses As List)
Dim user As UserDetails
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
user.courses.Initialize ' init list
user.players.Initialize ' init list
End If
End Sub
spits out just "[B]java.lang.NullPointerException[/B]" at "user.courses.Initialize"
Good point, strangely 'user' was working quite right before I added those 2 lists.. But still, I was assuming types don't need to initialize, -> worked for while but I really should read docs better!! Thanks!
Not strange if you think about it. If your type only contained primitive values then they are in effect initialised to a default value when you dim the instance of the type as dimming the type allocates the space for their values. However Lists are true objects, called reference types, and dimming the type allocates space for what is a pointer to the instance of the type. Those pointers however need initialising to point at a new instance of the type which is why you need to call Initialize. The same applies if your type contains arrays.