I create an app, which has a main screen (Screen1) and an optional screen (Screen2).
So here is Screen1’s initialization of global variables and the initializon of Screen1.
The init of Screen1 does the followings: sets the length of a list to a variable, sets the height of a canvas, places the sprite buttons to the exact places in the screen, then
reads the current dimming values of the spot light controllers (through a simple http request-response) and sets the variables S2 … S9
I print the values of S2 … S9 to Label1 to debug.
If you press the SpotFineTuning button Screen2 is opened and you can do what the button name says.
When you are done with that and press the Home sprite button in Screen2, screen2 will be closed and you can use screen1 again.
And there is an issue with it.
As you can see Screen1’s global variables initialization sets S2 … S9 to the value of 1. And the function ReadCurrentLightValues sets S2 … S9 based on the http response of the spot light controllers.
When I close Screen2, the values of S2 … S9 printed are always 1. (And as the responses of the webviewers arrived all the values are set correctly. But only in “Companion mode”. As I bake the app and install apk to the phone it seems that the value of S2 … S9 variables are somehow confused. It seems that the order of initializing global variables and Screen1.init is not fixed or the responses of webviewers are faster in “apk-mode” than the initializations of global variables.
So in apk the values of S2 … S9 behaves somewhat “random”.
I have some guesses to make some tricks avoiding this issue, but I really want a correct solution for this, not a workaround. I really want a solution to eliminate the reinitializition of global variables after closing Screen2 and going back to Screen1.
Thanks for your answers in advance!