I need to set a boolean variable at runtime that can be accessed by any other class (without having to pass the variable around from class to class). This variable will be a configuration setting, and will depend on some value set by the user at runtime.
I suspect a singleton is the way to go, but having spent the morning reading up on it, I seem to find a lot of examples (& arguments) on the best way to create them, without any mention of how to actually use them.
Is singleton the way to solve this?
If so, can anyone provide an example of a singleton, that can have a boolean value set, that can be accessed statically from any other class?
EDIT: I'm such an idiot (totally overcomplicating the problem, and missing the simplest solution).
public static volatile boolean yourBoolean;
Looks like it'll work perfectly