StateManager and CheckBoxes

William Hunter

Active Member
Licensed User
Longtime User
I am using a ScrollView with CheckBoxes in an interface for an application that is used to delete junk email.

I think I may have found a glitch in StateManager. In using it to restore the state of CheckBoxes, I have found a point at which it fails, giving this error at line 147:

java.lang.RuntimeException: Cannot parse: 0 as Boolean

The error only occurs after deletion of a checked item and then re-login, but only for the first rotation after re-login. On subsequent rotations the error does not occur. I have included the filtered log below, in which I have inserted a few notations. I hope all is clear.
B4X:
** Activity (main) Create, isFirst = true **

** Activity (main) Resume **

delFlag = false

'1.### first rotate is made - ScrollView not yet created

** Activity (main) Pause, UserClosed = false **

** Activity (main) Create, isFirst = false **

** Activity (main) Resume **

delFlag = false
'*** restore state successful

'2.### update - login for mail

'### second rotate - ScrollView created - CheckBox checked (no difference if un-checked)

** Activity (main) Pause, UserClosed = false **

** Activity (main) Create, isFirst = false **

** Activity (main) Resume **

delFlag = true
'*** restore state successful

'3.### deletion is made and auto re-login

'### third rotate - ScrollView created - CheckBox checked (no difference if un-checked)

** Activity (main) Pause, UserClosed = false **

** Activity (main) Create, isFirst = false **

** Activity (main) Resume **

delFlag = true

Error loading state.

java.lang.RuntimeException: Cannot parse: 0 as boolean
'??? RestoreState not successful

'4.### forth rotate - ScrollView created - CheckBox checked (no difference if un-checked)

** Activity (main) Pause, UserClosed = false **

** Activity (main) Create, isFirst = false **

** Activity (main) Resume **

delFlag = true
'*** restore state successful

This issue has been resolved. The error does not rest with StateManager, but rather with a tactical error in my own code. My appologies. :sign0013:
 
Last edited:
Top