I have a weird condition that has been hard to track down. Whenever it would fail in Release it would give the function name and say line 596 which didn't fit because those lines are like 70-100 and it would just say that a variable needed to be initialized first. This was strange since in that function I just load some values out of a database to a local List that is initialized there and uses a local Cursor that is setup using a Process Global SQL variable in a Code Module that is initialized as soon as the app starts and used in various Activities throughout.
I've been running it in Debug trying to track it down and it failes on this line:
It is saying my DB (SQL) variable isn't initialized. On one device it seems to happen every once in a while when I switch to another app somehow or press Home then return to my app which then resumes right where I left off and reloads the Case list. On another device it is actually my personal phone and I got a phone call...when I hung up and it returned to my app it crashed on the same line. It appears that even though the process is running and those variables are being used that Android is deleting them from memory.
Now, I call other activities and come back to this one all the time and it loads my cases without issue. So, how can I prevent Android from deleting a Process Global when the process is still running??? Adding isInitialized checks and re-initializing it everywhere kind of defeats the purpose of making a Process Global...
I've been running it in Debug trying to track it down and it failes on this line:
B4X:
dbCursor = Utility.DB.ExecQuery("SELECT CaseNum FROM Cases ORDER BY CaseNum")
It is saying my DB (SQL) variable isn't initialized. On one device it seems to happen every once in a while when I switch to another app somehow or press Home then return to my app which then resumes right where I left off and reloads the Case list. On another device it is actually my personal phone and I got a phone call...when I hung up and it returned to my app it crashed on the same line. It appears that even though the process is running and those variables are being used that Android is deleting them from memory.
Now, I call other activities and come back to this one all the time and it loads my cases without issue. So, how can I prevent Android from deleting a Process Global when the process is still running??? Adding isInitialized checks and re-initializing it everywhere kind of defeats the purpose of making a Process Global...