A angel Member Licensed User Longtime User Jan 27, 2014 #1 Hello How to save the state of one togglebutton in activity, other components not save thanks
Erel B4X founder Staff member Licensed User Longtime User Jan 28, 2014 #2 Code: Copy Sub Process_Globals Dim tbState As Boolean = False End Sub Sub Activity_Create 'load layout Togglebutton1.Checked = tbState End Sub Sub Activity_Pause tbState = ToggleButton1.Checked End Sub Upvote 0
Code: Copy Sub Process_Globals Dim tbState As Boolean = False End Sub Sub Activity_Create 'load layout Togglebutton1.Checked = tbState End Sub Sub Activity_Pause tbState = ToggleButton1.Checked End Sub
A angel Member Licensed User Longtime User Jan 28, 2014 #3 I wanted to use the module "StateManager" to save the state if the application closed, but do not know how to save the state of only one component and not the entire Activity Upvote 0
I wanted to use the module "StateManager" to save the state if the application closed, but do not know how to save the state of only one component and not the entire Activity
lemonisdead Well-Known Member Licensed User Longtime User Jan 28, 2014 #4 Hello, My little knowledge : for easiness I use Erel's PreferenceActivity library and store the state of the toggle button using a Boolean Code: Copy Sub ToggleButton1_CheckedChange(Checked As Boolean) If Checked Then Manager.SetBoolean("AC",True) Else Manager.SetBoolean("AC",False) End If End Sub You would recall the button's state in Activity_Resume Code: Copy If Manager.GetBoolean("AC") Then ToggleButton1.Checked=True Else ToggleButton1.Checked=False End If Upvote 0
Hello, My little knowledge : for easiness I use Erel's PreferenceActivity library and store the state of the toggle button using a Boolean Code: Copy Sub ToggleButton1_CheckedChange(Checked As Boolean) If Checked Then Manager.SetBoolean("AC",True) Else Manager.SetBoolean("AC",False) End If End Sub You would recall the button's state in Activity_Resume Code: Copy If Manager.GetBoolean("AC") Then ToggleButton1.Checked=True Else ToggleButton1.Checked=False End If