Hi,
I am sorry, I am lost. Could you please point me to a thread or tutorial about (I don't find one) ?
I am trying to understand how to store/read a Type into a List and Save/Read the List from a file. I get a casting error while trying to recover the type from the list.
I have thought/wrongly understood (?) that I could recover my types line by line from the list.
Many thanks.
I am sorry, I am lost. Could you please point me to a thread or tutorial about (I don't find one) ?
I am trying to understand how to store/read a Type into a List and Save/Read the List from a file. I get a casting error while trying to recover the type from the list.
I have thought/wrongly understood (?) that I could recover my types line by line from the list.
Many thanks.
B4X:
Sub Globals
Type tRec(Name As String, Value As Int)
End Sub
Sub TestRead
Dim tList As List
tList.Initialize
tList=File.ReadList(File.DirInternal,"TestRec")
Dim nPos As Int
nPos=tList.Size-1
Do Until nPos<0
Log("Reading line: " & nPos)
Dim Temp As tRec 'Type tRec
Temp.Initialize
Temp=tList.Get(nPos)
Log(Temp.Name & " : " & Temp.Value & CRLF)
nPos=nPos-1
Loop
End Sub