Android Question java.util.NoSuchElementException

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I am facing a weird error with the following code

B4X:
    For Each Key In mPointsLog.Keys
        
        Log("key: " & Key ) 'Prints PTSLog_0
        Dim TPTSItem1 As TPTSLogRec = mPointsLog.Get(Key)
        
        If TPTSItem1.blnSynced = False And Key <> PTSLog_GetMainRecordKey(PTSLog_GetCurrentSequenceNumber)  Then
            lstSortedList.Add( TPTSItem1 )
        Else if GeneralLib.GL_AIDTF_GetTimeDifference( GeneralLib.GL_GetDateTimeAsAIDTF, TPTSItem1.EndDate, GeneralLib.GL_DATE_DIFF_UNIT_DAYS ) > 30 Then
            
            PTSLog_ViewContents 'Prints all elements in mPointsLog showing that PTSLog_0 exists at this point
            mPointsLog.Remove(Key) 'Causing a crash: java.util.NoSuchElementException for PTSLog_0
        End If
    Next


I am using B4A 8.00.
This code was definitely tested before and was ok at a certain point

Thanks
iCAB
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel,
Thanks for your reply!

Are you sure this didn't work before?
I have it used in few places that it could have been impossible to miss.
 
Upvote 0
Top