Hello all, here is a basic question I can't solve. Surely something simple.
Here is my code :
B4X:
Sub Globals
Type arrAnim(index As Int, time As Int, value As Int)
Dim myArr As arrAnim
End Sub
Sub TestList
Dim myList As List
Dim time As Long
time = DateTime.Now
myList.Initialize
For i = 0 To 10
myArr.time = DateTime.Now - time
myArr.value = i * 3
myArr.index = i
myList.Add(myArr)
Next
End Sub
At the end I get a list that contains all items with same values.
Too obvious to find it by myself
I was thinking a way like that ... but Dim inside a loop is strange for me (I come from Pascal language).
I'll give it a try ... thank you very much for you help.
Another thing about lists : may I trust the arrangement or do I need to use an index to sort elements?
I'll privately share with you a secret:
You don't need to initialize a custom type if you are assigning values to its fields or all the fields types are numeric, strings or booleans. Though it is a good practice to always initialize types.
I'll privately share with you a secret:
You don't need to initialize a custom type if you assigning values to its fields or all the fields types are numeric, strings or booleans. Though it is a good practice to always initialize types.