Android Question Closing activity, var still ok?


Well-Known Member
Licensed User

If I have activity, let's say main activity, and in there I have global vars
If I finish the activity, is it still valid using those vars (reading and writing data to it?) - if yes how come, if now any suggestions (I notice that even I activity.finish the activity, vars are still valid)

What about GlobalCode Module?


Licensed User
You should read the beginners guide, it has a chapter dedicated to activities life cycle.
Activities are not killed on app exit, and the resources are not freed up... They go "background" and only when the OS needs those resources it will be killed.
"GlobalCode module"?? I guess you mean Code Modules... They are only containers for in-app often used code, so variables set by these modules, behave the same as any others...

The problem is, you'll never know when your app resources are going to be freed.
Last edited:


Well-Known Member
Licensed User
What about GlobalCode Module?
Hello Shay,

Do you mean : what happens about global variables declared inside the code module ? If yes :
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
So they should be available as any of the Process globals.