I can store multiple maps in a list and save it to device . But I can't retrieve it .
How to read it ?
B4X:
Dim iMap As Map
Dim ilist As List
Dim name,age As String
ilist.Initialize
iMap.Initialize
ilist.Clear
iMap.Clear
name = txtName.Text
age = txtAge.Text
If File.Exists(File.DirInternal,"sgj.txt") = True Then
ilist = File.ReadList(File.DirInternal,"sgj.txt")
iMap.Put("Name",name)
iMap.Put("Age",age)
ilist.Add(iMap)
File.Delete(File.DirInternal,"sgj.txt")
File.WriteList(File.DirInternal,"sgj.txt",ilist)
txtName.Text = ""
txtAge.Text = ""
xui.MsgboxAsync("Success","SGJoisa")
Else
iMap.Put("Name",name)
iMap.Put("Age",age)
ilist.Add(iMap)
File.WriteList(File.DirInternal,"sgj.txt",ilist)
txtName.Text = ""
txtAge.Text = ""
xui.MsgboxAsync("Success","SGJoisa")
End If
Private Sub btnRead_Click
Dim iMap As Map
Dim ilist As List
Dim name,age As String
ilist.Initialize
iMap.Initialize
ilist.Clear
iMap.Clear
ilist = File.ReadList(File.DirApp,"sgj.txt")
iMap = ilist.Get(0)
name = iMap.Get("Name")
age = iMap.Get("Age")
txtName.Text = name
txtAge.Text = age
End Sub
How to read it ?