Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
xui.SetDataFolder("kvs_test")
kvs.Initialize(xui.DefaultFolder,"kvs.dat")
activeMap.Initialize
archiveMap.Initialize
'did we load an existing KVS?
If kvs.ListKeys.Size = 0 Then
'no
Log("Building kvs")
activeMap.Put("A B 3",Array("one","two","three","four","five")) 'activeMap.Put("A B 3",Array As String("one","two","three","four","five")) will still work
activeMap.Put("C D 3",Array("one","two","three","four","five"))
activeMap.Put("E F 3",Array("one","two","three","four","five"))
activeMap.Put("G H 3",Array("one","two","three","four","five"))
archiveMap.Put("Z Y 5",Array("one","two","three","four","five"))
kvs.Put("active",activeMap)
kvs.Put("archive",archiveMap)
End If
End Sub
Private Sub B4XPage_Appear
activeMap = kvs.Get("active")
archiveMap = kvs.Get("archive")
LogMap("Active", activeMap)
LogMap("Archive", archiveMap)
End Sub
Private Sub LogMap(Title As String, M As Map)
Log(Title & "...")
Dim sb As StringBuilder
sb.Initialize
For Each key As String In m.Keys
Log(key)
Dim strArr() As Object = m.Get(key)
If strArr = Null Then Continue
For Each str As String In strArr
sb.Append(TAB)
sb.Append(str)
Next
Next
Log(sb.ToString)
Log("-------")
End Sub