Hi All.
I have the following code.
If I try to delete the last record immediately it crashes (Release)
Example if I delete randomly (1,3,2,4) everything ok, but when I get to the last one it gives the error java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
But if add Sleep(0) the same code work:
Bug or what ?
I have the following code.
If I try to delete the last record immediately it crashes (Release)
Example if I delete randomly (1,3,2,4) everything ok, but when I get to the last one it gives the error java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
B4X:
Sub lbl_cancello_extra_selezionato_MouseClicked (EventData As MouseEvent)
Dim b As B4XView = Sender
Dim index_uno As Int = clv.GetItemFromView(b.Parent)
Log("Index: " & index_uno)
Try
clv.RemoveAt(index_uno)
Catch
Log(LastException)
End Try
End Sub
But if add Sleep(0) the same code work:
B4X:
Sub lbl_cancello_extra_selezionato_MouseClicked (EventData As MouseEvent)
Dim b As B4XView = Sender
Dim index_uno As Int = clv.GetItemFromView(b.Parent)
Sleep(0)
Log("Index: " & index_uno)
Try
clv.RemoveAt(index_uno)
Catch
Log(LastException)
End Try
End Sub
Bug or what ?