I need to create an external class for storing activity data during the activity lifecycle.
Here is the envisioned Sequence:
The Activity is quite complex. Having sophisticated custom elements.
So I need to be able to carry the state across from activity destruction to activity recreation. I understand that UI elements cannot be serialised so it is not possible to save the activities in a datastore. So, I will have to save them in a persistent class.
Now to the question. How is this done?
I have tried declaring the class in my Main Activity, and then using it in the above activity (Working Activity), but it keeps giving me an error. If I declare the class in the Working Activity, then it is destroyed when the activity is destroyed during the pause event.
By declared I am using code like:
Any suggestions?
Here is the envisioned Sequence:
The Activity is quite complex. Having sophisticated custom elements.
So I need to be able to carry the state across from activity destruction to activity recreation. I understand that UI elements cannot be serialised so it is not possible to save the activities in a datastore. So, I will have to save them in a persistent class.
Now to the question. How is this done?
I have tried declaring the class in my Main Activity, and then using it in the above activity (Working Activity), but it keeps giving me an error. If I declare the class in the Working Activity, then it is destroyed when the activity is destroyed during the pause event.
By declared I am using code like:
B4X:
'In Working Activity
Private StorageClass1 As StorageClass
'When I tried Main Activity Declaration
Public StorageClass1 As StorageClass
Any suggestions?
Last edited: