I have a problem that is very strange to me as I have used this method successfully before but now it does not behave as I expect. I am creating a list of lists but the masterlist seems to follow the state of the sublist no matter what i do. See the following test code
The state of the lists is the following after each line in activity_create assuming the following format (l1,mainlist)
line 1 ([],[])
line 2 ([],[])
line 3 (["a"],[])
line 4 (["a"],["a"])
line 5 ([],[])
line 6 (["b"],["b"])
line 7 (["b"],["b","b"])
This is what I expect:
line 1 ([],[])
line 2 ([],[])
line 3 (["a"],[])
line 4 (["a"],["a"])
line 5 ([],["a"])
line 6 (["b"],["a"])
line 7 (["b"],["a","b"])
Please help this is driving me crazy.
Dan
B4X:
Sub Globals
Dim MainList As List
Dim l1 As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
l1.Initialize
MainList.Initialize
l1.Add("a")
MainList.Add(l1)
l1.Clear
l1.Add("b")
MainList.Add(l1)
End Sub
line 1 ([],[])
line 2 ([],[])
line 3 (["a"],[])
line 4 (["a"],["a"])
line 5 ([],[])
line 6 (["b"],["b"])
line 7 (["b"],["b","b"])
This is what I expect:
line 1 ([],[])
line 2 ([],[])
line 3 (["a"],[])
line 4 (["a"],["a"])
line 5 ([],["a"])
line 6 (["b"],["a"])
line 7 (["b"],["a","b"])
Please help this is driving me crazy.
Dan