1. I add list L1 to raf
2. I append list L2 to raf.
3. I read list L3 as the entire raf file, but L2 data is not shown in L3 when raf is read. Any thoughts?
Thank you
I am simply testing the power of RAF a little further, using RAF 2.20. Here is the complete project:
2. I append list L2 to raf.
3. I read list L3 as the entire raf file, but L2 data is not shown in L3 when raf is read. Any thoughts?
Thank you
I am simply testing the power of RAF a little further, using RAF 2.20. Here is the complete project:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If File.Exists(File.DirRootExternal, "myraffile") Then
File.Delete(File.DirRootExternal, "myraffile")
End If
raf.Initialize(File.DirRootExternal, "myraffile", False)
Dim L1 As List
L1.Initialize
Dim MyMap As Map
MyMap.Initialize
MyMap.Put("City", "AA")
MyMap.Put("Country", "Prime Country")
MyMap.Put("Continent", "America")
MyMap.Put("Tourism", "Good")
L1.Add(MyMap)
Dim MyMap As Map
MyMap.Initialize
MyMap.Put("City", "EE")
MyMap.Put("Country", "Second Country")
MyMap.Put("Continent", "Europe")
MyMap.Put("Tourism", "Great")
L1.Add(MyMap)
Dim MyMap As Map
MyMap.Initialize
MyMap.Put("City", "FF")
MyMap.Put("Country", "Third Country")
MyMap.Put("Continent", "Africa")
MyMap.Put("Tourism", "Very good")
L1.Add(MyMap)
raf.WriteB4XObject(L1, 0)
Log("Size after L1: " & raf.Size)
Dim L2 As List
L2.Initialize
Dim MyMap As Map
MyMap.Initialize
MyMap.Put("City", "II")
MyMap.Put("Country", "Fourth Country")
MyMap.Put("Continent", "Australia")
MyMap.Put("Tourism", "Terrific")
L2.Add(MyMap)
raf.WriteB4XObject(L2,raf.CurrentPosition)
Log("Size after L2: " & raf.Size)
Dim L3 As List
L3.Initialize
L3=raf.ReadB4XObject(0) 'read to a new list L3
Log("size: " & L3.Size & ". " & L3 )
For x = 0 To L3.Size - 1
Dim MyMap As Map
MyMap = L3.Get(x)
For Each k As Object In MyMap.keys
Log(k & " " & MyMap.Get(k) )
Next
Log("-------")
Next
raf.Close
End Sub[code]