Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SaveFileName As String = "SaveFile.txt"
Dim SavedData As String
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Panel1 As Panel
Private RadioButton1 As RadioButton
Private RadioButton2 As RadioButton
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
If File.Exists (File.DirDefaultExternal, SaveFileName) = True Then
SavedData = File.ReadString(File.DirDefaultExternal, SaveFileName)
If SavedData = "1.txt" Then
RadioButton1.Checked = True
'It only works if I add the line below
RadioButton1_CheckedChange(True)
Else
RadioButton2.Checked = True
'It only works if I add the line below
RadioButton2_CheckedChange(True)
End If
Else
SavedData = "1.txt"
RadioButton1.Checked = True
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub RadioButton1_CheckedChange(Checked As Boolean)
File.WriteString(File.DirDefaultExternal, SaveFileName, "1.txt")
'Do other stuff...
End Sub
Sub RadioButton2_CheckedChange(Checked As Boolean)
File.WriteString(File.DirDefaultExternal, SaveFileName, "2.txt")
'Do other stuff...
End Sub