Android Question [SOLVED] problem with list variable

noeleon

Member
Licensed User
B4X:
Sub Process_Globals
    Dim List1, List2 As List
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
    List1.Initialize
    List1.AddAll(Array As String("a", "b", "c"))
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub Activity_Click
    Log("List1.Size: "&List1.Size)
    List2.Initialize
    List2 = List1
    Log("List2.Size: "&List2.Size)
End Sub
After 3 clicks this is the output:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
List1.Size: 3
List2.Size: 3
List1.Size: 3
List2.Size: 0
List1.Size: 0
List2.Size: 0
Why did List1 lose its contents when I did not clear or reinitialize it?
 
Top