Android Question managing global variables consistently

westingenieria

Active Member
Licensed User
Longtime User
hi all anyone can help me with this issue?
, I have doubt to use the gloables variables, since I have a module for handling these, but sometimes when I update its value in one activity, and occupied after a service does not work the first time, the second time that uses the global variable cool, but I had updated their value. what is the best way to work with global variables?. because when you use the module for this purpose is not working properly and I generated data problems with the application, because sometimes I change the variables and the consistency of its values is lost. better work in global variables database?. there is a singleton pattern (as in java) for consistency of information?

thank you very much and attentive to your answer.
 
Last edited:

westingenieria

Active Member
Licensed User
Longtime User
ok. sorry, then. I change my question for all users. now you can help me with the answer please, I would also like to know as a module B4A works. it is useful to use a module to manage global variables? How else do you recommend? thanks in advanced.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
In a simple Project just use sub's and call them with parameters. In bigger one's you can use Process Globals to give access to all modules. Don't define "all" variables in one module (see it as a class or sub - better to handle if the data/function is close to each other ). The rest is a matter of style/taste.
 
Upvote 0
Top