Here's the code I use to check if a file exist. Tried both True & 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
I don't understand.
You check if the file exists in File.DirDefaultExternal If File.Exists(File.DirDefaultExternal,"button.txt") = True Then
but then you save on File.DirRootExternal File.WriteMap(File.DirRootExternal, "button.txt", Map1)
Is this really what you want ?