Android Question Writing in a List containing type structures

Rainer@B4A

Member
Licensed User
Longtime User
I tried to change some data storage from array to list.
With an Array it was easy:

B4X:
Type Player (Name As String, Loca As Location) ' String, GPS structure
Dim Players(10) as Player
Players(0).Name = "Rainer"
Players(0).Loca = Location1


For a List some more code is necessary:

B4X:
Type Player (Name As String, Loca As Location) ' String, GPS structure
Dim Players As List
Players.Initialize

Dim Player As Player
Player.Initialize 
Player.Loca.Initialize

Player.Name = "Rainer"
Player.Loca = Location1
Players.Add(Player)


But now I run into compiler errors, because I don't know how to set the value by index !

Players.Loca.Set(0, Location1) ' ????
Players.Set(0, Location1).Loca ' ????



Many Thanks
 
Top