Process_globals variables not sending values between activities

mokrokuce

Member
Licensed User
Longtime User
Hi,
I have declared global vars in my main module, and when I assign them a value they have that value until I do activity.finish

Trouble is, this worked fine until one point in time, then I tried releasing app in obfuscated mode (that is actually the last thing I remember doing prior to problem emerging), and at the next compiling it stopped working.

Here's some code:
Declaring vars in Main module (called Main)
B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
Dim IdentsFilterState As Boolean
Dim IdentsFilterSet As String
End Sub

Assigning value to global var in another module
B4X:
Sub cmdSnimi_click
   Main.IdentsFilterState=True
   Main.IdentsFilterSet=" and PrimClassif like '%" & IdentsFilterPrimKlas & "%' and SecClassif like '%" & IdentsFilterSekKlas & "%' and acSupplier like '%" & IdentsFilterDob & "%'"
   Log ("Kreiran filter:" & Main.IdentsFilterSet)
   Activity.Finish
End Sub
Here the LogCat displays newly assigned value to Main.IdentsFilterSet

After the code returns to previous activity in Activity_resume, the value is lost:
B4X:
Sub Activity_Resume
Log("Main.IdentsFilterState:" & Main.IdentsFilterState)
End Sub

I would like to add that I am using some other global variables just fine, only these few new ones that appear in a new module are problematic.
Btw, sorry if someone else already posted similar problem. Tried searching posts before posting, no luck.
 
Last edited:

mokrokuce

Member
Licensed User
Longtime User
Solved it.
Created a whole new module, named it with a different name, pasted all the code into it and it worked.
 
Upvote 0
Top