coder19075
New Member
I'm getting a bug on just trying to increment an integer.
The error is: java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
Here is the code to reproduce:
The error is: java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
Here is the code to reproduce:
B4X:
Dim lst As List
lst.Initialize
Dim obj1 As Map
obj1.Initialize
obj1.Put("id", 888)
Dim obj2 As Map
obj2.Initialize
obj2.Put("id", 999)
Dim obj3 As Map
obj3.Initialize
obj3.Put("id", 999)
lst.Add(obj1)
lst.Add(obj2)
lst.Add(obj3)
Dim lst2 As List
lst2.Initialize
For Each p As Map In lst
Dim i As Int = 0
For Each p2 As Map In lst
If p.Get("id") = p2.Get("id") Then
lst.RemoveAt(i)
End If
i = i + 1 'error in this line
Next
lst2.Add(p)
Next
Last edited: