I am trying to use the StateManager library to save & restore the state of my application which has one activity and a tabhost with 4 tabs. The problem is that the tab that was active at the time of an orientation change is not restored.
Some code:
Is there something I am missing?
Some code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If StateManager.RestoreState(Activity, "Main", 60) = False Then
'set the default values
' EditText1.Text = "Default text"
' EditText2.Text = "Default text"
End If
Activity.LoadLayout("MainMenu")
tbhMain.AddTab("Select Route","SelectRoute")
tbhMain.AddTab("Load","Load")
tbhMain.AddTab("Deliver","Deliver")
tbhMain.AddTab("Upload","Upload")
End Sub
Sub Activity_Resume
StateManager.ResetState("Main")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
StateManager.ResetState("Main")
Else
StateManager.SaveState(Activity, "Main")
End If
StateManager.SaveSettings
End Sub
Is there something I am missing?