Android Question Class_Globals

Arf

Well-Known Member
Licensed User
Longtime User
Is Class_Globals similar to Globals in B4A - ie their lifetime is valid while the page is active?
And are they valid in code modules as well as classes?

I had a problem with pg always seemingly being initialised after first entry, and I've just realised that of course process_globals won't get destroyed. So I am looking for a storage type that is valid for the lifetime of an page.
 

Roycefer

Well-Known Member
Licensed User
Longtime User
What do you mean by "page"? Do you mean Activity?

Class_Globals is used inside a user-defined class. If you make them Private, they will only be visible inside that class. If you make them Public (or just use "Dim", which is the same as Public) then they will accessible from outside the class. Either way, you must create an instance of that class to use them. Code modules don't have to be (and cannot be) instantiated. Once you write the code module, its global variables are accessible anywhere else in the project.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…