Android Question List.Clear crush

yaniv hanya

Active Member
Licensed User
I have this code

B4X:
If currentFilesLst.Size>0 Then
        currentFilesLst.Clear
    End If

currentFilesLst is alist of files names and has data. when it gets to the currentFilesLst.Clear
it crush and i get this log


it worked before and i cann't understend what hapend
what should i chck?
 

emexes

Expert
Licensed User
To diagnose the problem, try:
B4X:
Do While CurrentFilesLst.Size > 0
    Log( CurrentFilesList.Get(0) )
    CurrentFilesList.RemoveAt(0)
Loop
... and if that works (wtf?) then perhaps just delete the Log line and it's: job done!

One possibility is that you've added the list to itself (I'm pretty sure recursion is allowed) and when that particular item is deleted, it... well, I don't know what would happen, but I'm sure there would be some complaining about it aka error message!!!

 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…