So I discovered that the best way to load and save settings is to use MAP files, fine.
In my load I initialize Map1 as a Map and then call my subs
So I created 2 subs, SaveIni() and this one:
Sub LoadIni(fPath As String,filename As String)
Dim i As Int
'Usage: 'myhost = LoadIni(File.DirDefaultExternal,"MYsettings.ini")
Map1 = File.ReadMap(fPath,filename)
For i = 0 To Map1.Size - 1
If Map1.GetKeyAt(i) = "ServerIP" Then
ServicesvrIP = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "ServerPort" Then
ServicesvrPORT = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "LocalID" Then
ServiceARCid = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "RingToneToUse" Then
SelectedTone = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "PasswordLockToUse" Then
LockoutPassword = Map1.GetValueAt(i)
End If
Next
End Sub
My app is crashing and in the logs I get:
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
What am I doing wrong?
How can I check for the file and create it if it does not yet exist ?
In my load I initialize Map1 as a Map and then call my subs
So I created 2 subs, SaveIni() and this one:
Sub LoadIni(fPath As String,filename As String)
Dim i As Int
'Usage: 'myhost = LoadIni(File.DirDefaultExternal,"MYsettings.ini")
Map1 = File.ReadMap(fPath,filename)
For i = 0 To Map1.Size - 1
If Map1.GetKeyAt(i) = "ServerIP" Then
ServicesvrIP = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "ServerPort" Then
ServicesvrPORT = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "LocalID" Then
ServiceARCid = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "RingToneToUse" Then
SelectedTone = Map1.GetValueAt(i)
Else If Map1.GetKeyAt(i) = "PasswordLockToUse" Then
LockoutPassword = Map1.GetValueAt(i)
End If
Next
End Sub
My app is crashing and in the logs I get:
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
What am I doing wrong?
How can I check for the file and create it if it does not yet exist ?