Hi, with B4A with the following code I can write and read a configuration for my App
B4X:
Sub saveconfig
Dim TextWriter As TextWriter
TextWriter.Initialize(File.OpenOutput(File.DirInternal, "MyConfig", False))
TextWriter.WriteLine(Text1.text)
TextWriter.WriteLine(Text2.text)
TextWriter.WriteLine(Text3.text)
TextWriter.WriteLine(Text4.text)
TextWriter.close
End Sub
Sub openconfig
Dim TextReader1 As TextReader
If File.Exists(File.DirInternal,"MyConfig") Then
TextReader1.Initialize(File.OpenInput(File.DirInternal,"MyConfig"))
Text1.text= TextReader1.Readline
Text2.text= TextReader1.Readline
Text3.text= TextReader1.Readline
Text4.text= TextReader1.Readline
TextReader1.Close
End Sub
How to do it with B4I for IOS, I searched in the forum but I couldn't
to understand how to do it, can someone help me with an example similar to mine
Thank you Aminoacid, but I don't know if I understood correctly,
should I do this?, always repeat the path. How to close everything
I tried writing and saving everything seems ok, but when reading crashes
B4X:
Sub saveconfig
File.WriteString(xui.DefaultFolder, "MyConfig",Text1.text)
File.WriteString(xui.DefaultFolder, "MyConfig",Text2.text)
.
.
End Sub
Sub openconfig
If File.Exists(xui.DefaultFolder, "MyConfig") Then
Text1.Text =File.ReadString(xui.DefaultFolder,"MyConfig")
Text2.Text =File.ReadString(xui.DefaultFolder,"MyConfig")
.
.
End Sub