Hi
This is strange as now and then my phone (new and the old one) suddenly cannot read or write to/from either its internal or external card.
All tests which I have performed check out ok. There's no restrictions, directories are all readable/writeable and even the code to test for this doesn't return any error.
The application simply holds everything in cache and the TextWriter instance(s) do not write the file.
This is my code from the [Activity_Create(FirstTime... MAIN Module...
Would there be any other reason as to why I cannot get my phone to write text files?
Your help is much appreciated.
Azhar
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("astro1")
' File.Delete(File.DirDefaultExternal,"userSettings.txt")
' File.Delete(File.DirDefaultExternal,"userLocations.txt")
If File.ExternalReadable = False Then
Msgbox("Cannot read from storage card!","")
End If
If File.ExternalWritable = False Then
Msgbox("Cannot write to storage card!","")
End If
Log("File.DirDefaultExternal is " & File.DirDefaultExternal)
If FirstTime Then
If File.Exists(File.DirDefaultExternal,"userLocations.txt") = False Then
'ask user to name current location
Dim result As Int
result = Msgbox2("Would you like to name this location?", "New Location", "Yes", "", "No", Null)
If result = DialogResponse.POSITIVE Then
'load userLocation form
StartActivity(userLocation)
Else
'keep in roaming mode with no altitude
Msgbox("Okay, altitude will not be used in calculations and will remain in 'Roaming Mode'", "Notice")
End If
End If
'need to see if user settings file exists, if not then create a generic one
'read the userSettings database and update all comboBoxes and bullets
If File.Exists(File.DirDefaultExternal,"userSettings.txt") Then
common.readUserSettingsFile
Else
'problem here or probably immediately after 1st installation
'write a generic userSettings file.
Msgbox("userSettings file doesn't exist! Creating one now.","")
Dim writer As TextWriter, userSettingString As String
writer.Initialize(File.OpenOutput(File.DirDefaultExternal,"userSettings.txt",False))
'userSettingString = "123404010100111100" 'default settings
userSettingString = "141004010100111100" 'my own settings
writer.WriteLine(userSettingString)
writer.Close
End If
End If
This is strange as now and then my phone (new and the old one) suddenly cannot read or write to/from either its internal or external card.
All tests which I have performed check out ok. There's no restrictions, directories are all readable/writeable and even the code to test for this doesn't return any error.
The application simply holds everything in cache and the TextWriter instance(s) do not write the file.
This is my code from the [Activity_Create(FirstTime... MAIN Module...
Would there be any other reason as to why I cannot get my phone to write text files?
Your help is much appreciated.
Azhar
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("astro1")
' File.Delete(File.DirDefaultExternal,"userSettings.txt")
' File.Delete(File.DirDefaultExternal,"userLocations.txt")
If File.ExternalReadable = False Then
Msgbox("Cannot read from storage card!","")
End If
If File.ExternalWritable = False Then
Msgbox("Cannot write to storage card!","")
End If
Log("File.DirDefaultExternal is " & File.DirDefaultExternal)
If FirstTime Then
If File.Exists(File.DirDefaultExternal,"userLocations.txt") = False Then
'ask user to name current location
Dim result As Int
result = Msgbox2("Would you like to name this location?", "New Location", "Yes", "", "No", Null)
If result = DialogResponse.POSITIVE Then
'load userLocation form
StartActivity(userLocation)
Else
'keep in roaming mode with no altitude
Msgbox("Okay, altitude will not be used in calculations and will remain in 'Roaming Mode'", "Notice")
End If
End If
'need to see if user settings file exists, if not then create a generic one
'read the userSettings database and update all comboBoxes and bullets
If File.Exists(File.DirDefaultExternal,"userSettings.txt") Then
common.readUserSettingsFile
Else
'problem here or probably immediately after 1st installation
'write a generic userSettings file.
Msgbox("userSettings file doesn't exist! Creating one now.","")
Dim writer As TextWriter, userSettingString As String
writer.Initialize(File.OpenOutput(File.DirDefaultExternal,"userSettings.txt",False))
'userSettingString = "123404010100111100" 'default settings
userSettingString = "141004010100111100" 'my own settings
writer.WriteLine(userSettingString)
writer.Close
End If
End If