Android Question Change Theme at Runtime and StateManager

stu14t

Active Member
Licensed User
This has got me a little confused. I'm using the code from Erel's example here : Change Theme at Runtime and that is working fine, no issues and I notice that Erel says to use StateManger to save the state of the app but this is not working as I expected. When I look at the logs when I change the theme is shows: ** Activity (main) Pause, UserClosed = true ** and because this is true it's not saving the state using the standard code from the StateManager, is that correct?

StateManager example Code:
B4X:
ub Activity_Pause (UserClosed As Boolean)
 
    If UserClosed Then
        StateManager.ResetState("Main")
    Else
        StateManager.SaveState(Activity, "Main")
    End If
    
    StateManager.SaveSettings
    
    GPS1.Stop
    awake.ReleaseKeepAlive
    
End Sub
I suspect it's going to need a workaround as I do use the back button to close off my app.
 
Top