Let's say I have the following:
Once I insert the 2 maps (Item1, Item2) into SuperMap, I write the SuperMap to a file.
When I go to load the SuperMap file, would it be all mess up?
What should I use/do if I want to store a map within a map and be able to save/read that map into a file?
B4X:
Sub InsertAndSave()
If SuperMap.IsInitialized = False Then
SuperMap.Initialize
End If
Dim Item1 As Map
Item1.Initialize
Item1.Put("Key1", "Item1 Value1")
Item1.Put("Key2", "Item1 Value2")
Item1.Put("Key3", "Item1 Value3")
SuperMap.Put(SuperMap.Size + 1, Item1 )
Dim Item2 As Map
Item2.Initialize
Item2.Put("Key1", "Item2 Value1")
Item2.Put("Key2", "Item2 Value2")
Item2.Put("Key3", "Item2 Value3")
SuperMap.Put(SuperMap.Size + 1, Item2 )
File.WriteMap(File.DirInternal, "SuperMap", SuperMap)
End Sub
Once I insert the 2 maps (Item1, Item2) into SuperMap, I write the SuperMap to a file.
When I go to load the SuperMap file, would it be all mess up?
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
If File.Exists(File.DirInternal, "SuperMap") Then
SuperMap.Initialize
SuperMap = File.ReadMap(File.DirInternal, "SuperMap")
Dim m As Map
m.Initialize
m = SuperMap.Get(1)
MsgboxAsync(m.Get("Key1"), "")
End If
End Sub
What should I use/do if I want to store a map within a map and be able to save/read that map into a file?
Last edited: