Dealing with changing orientation for the first time. Not working for me. Have been studying the tutorial. In the sample code:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
StateManager.ResetState("Main")
Else
StateManager.SaveState(Activity, "Main")
End If
StateManager.SaveSettings
End Sub
StateManager.SaveSettings never does anything because settings.IsInitialized is always false. I cannot find anything in the Main module example that would ever initialize settings.
StateManager.SaveSettings never does anything because settings.IsInitialized is always false. I cannot find anything in the Main module example that would ever initialize settings.
So how does this from the modulecode ever do anything in the IF block:
B4X:
'Stored the settings in a file
Public Sub SaveSettings
If settings.IsInitialized Then
Log("SaveSettings")
For i = 0 To settings.Size - 1
Log(settings.GetKeyAt(i) & " " & settings.GetValueAt(i))
Next
File.WriteMap(File.DirInternal, settingsFileName, settings)
End If
End Sub