Why doesn't this code work???? I want to write to a list of objects, then cycle through the list to populate a listview, but the list view just shows the last entry from the list all the time!!!
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Dates")
'initialize dates list
datesList.Initialize
'initialize date object
lvd.Initialize
'first date object
lvd.Name = "First Date"
lvd.Day = 24
lvd.Month = 4
lvd.Year = 2009
'add date object to dates list
datesList.Add(lvd)
'second date object
lvd.Name = "Got Engaged"
lvd.Day = 30
lvd.Month = 12
lvd.Year = 2011
'add object to list
datesList.Add(lvd)
'loop through list and write entries as strings to listView
For x = 0 To datesList.Size-1
lvd = datesList.Get(x)
lv_dates.AddTwoLines(lvd.Name & " - " & x,lvd.Day & " - " & getMonth(lvd.Month) & " - " & lvd.Year)
'returning same value each time!!!!
Next
End Sub