Ok, here it is; the code to assign the buttons from the text file
B4X:
'Again we are Not initializing the Map.
'assign button text from file
Map1 = File.ReadMap(File.DirRootExternal, "button.txt")
Button1.Text = Map1.GetValueAt(0)
Button2.Text = Map1.GetValueAt(1)
Button3.Text = Map1.GetValueAt(2)
Button4.Text = Map1.GetValueAt(3)
The code I use to write to the file...
B4X:
'update mapped Button In saved File
Dim Map1 As Map
Map1.Initialize
Map1.Put(0,Button1.Text)
Map1.Put(1,Button2.Text)
Map1.Put(2,Button3.Text)
Map1.Put(3,Button4.Text)
File.WriteMap(File.DirRootExternal, "button.txt", Map1)
Oh, and the code I use to check to see if the file exists... doesn't seem to work on virtual machine? (I tried both True and False here...)
B4X:
'create file first time if it doesn't exist -- not working -- fix it
If File.Exists(File.DirDefaultExternal,"button.txt") = True Then
Map1.Initialize
Map1.Put(0,Button1.Text )
Map1.Put(1,Button2.Text )
Map1.Put(2,Button3.Text )
Map1.Put(3,Button4.Text )
File.WriteMap(File.DirRootExternal, "button.txt", Map1)
End If