I’m looking to store a variable between app sessions, so this seems like the perfect thing.
So in my block I initalise the variable, the app then does something and sets this to a text value, all good.
However, when I refresh the test app (using live view), it of course just reinitialises the variable back to null as it loads and doesn’t “store” anything.
Is this just a consequence of testing using the live preview or am I missing something? Does a “real” app know that the variable already exists and therefore doesn’t reinitialise it?
Yeah - even when the app is created - this value is being initialised when the app starts and doesn’t get remembered between app starts.
So how are you supposed to create a persistent variable which doesn’t re=initialise when you start the app.
If you use a stored variable, it will keep its value between sessions.
Just make sure to check if the stored variable is equal to null when the screen opens. If so, set it to a starting value (such as an empty string “” or zero).
It’s best to test this on a mobile device.
This is what I have:
So it should be initialising as “null” I believe. But doesn’t persist between sessions. If I set this vCurrentJob variable as something in the app - then close the app down, and relaunch it. txtCurrentJob.text is just blank.
Those blocks should work but you need to do what I suggested and check for a null value.
This is a screenshot I found online but it shows an example of this:
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.