Hello,
I use Maps in the same way that I used to use INI files.
I declare my maps in globals:
Public MyMap as Map
in Activity Create (when FirstTime is True) I initialize the map and check to see whether the map file exists otherwise I load the map default values:
If (FirstTime) Then MyMap.Initialize
If (File.Exists(File.DirDefExternal, "MMFile.txt") = False) Then
MyMap.Put("somevar", 0)
File.WriteMap(File.DirDefExternal, "MMFile.txt", MyMap)
End If
End If
In Activity Resume I read the map file
MyMap = File.ReadMap(File.DirDefExternal, "MMFile.txt")
In Activity Pause I write the map file
File.WriteMap(File.DirDefExternal, "MMFile.txt", MyMap)
Within the program code I can use the values in the map file directly almost as if they were variables
i = MyMap.Get("somevar")
Note: This was all written off the top of my head so there may be some small syntax and spelling errors – I can't guarantee it will compile correctly, but it does show how I use the Map as an INI.
Also Note: It may be worth considering using DirInternal instead of DirDefExternal. The external directory may not exist on some devices, but it's not a protected directory that's hidden from view.
Barry.