I have this code
when I pause the program at the msgbox all items in my list are set to the last entry - 2, Camp Hill
why is this?
If I create 3 different ami variables it will work.
This is puzzling.
regards, Ricky
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Type typeAddMenuItem(Id As Int, MenuItem As String)
Dim AddMenuItems As List : AddMenuItems.Initialize
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub bDoit_Click
Dim ami As typeAddMenuItem
ami.Initialize
ami.Id = 4
ami.MenuItem = "City"
AddMenuItems.Add(ami)
ami.Initialize
ami.Id = 3
ami.MenuItem = "Woolloongabba"
AddMenuItems.Add(ami)
ami.Initialize
ami.Id = 2
ami.MenuItem = "Camp Hill"
AddMenuItems.Add(ami)
Msgbox("Done", "")
End Sub
when I pause the program at the msgbox all items in my list are set to the last entry - 2, Camp Hill
why is this?
If I create 3 different ami variables it will work.
This is puzzling.
regards, Ricky