Java friends, in objectiveC with a singleton, normally you have a macro,
#define STATE [State sharedState]
Then throughout the project, anywhere at all, you just type STATE.explode() STATE.attackTanks() and so on. Similarly in Swift you can access a macro in "one word" with no further effort.
In an Android project,
public class Handy { // singleton
private static Handy ourInstance = new Handy();
private Handy() {}
public synchronized static Handy getInstance(){return ourInstance;}
public void Example(String ss) { Log.v("Java rocks ", ss); }
}
you can access it everywhere like this
Handy.getInstance()
No problem. But my goal is to use that anywhere with "one word" only.
Of course, you can Handy HANDY = Handy.getInstance();
at the top of each file you need to use it in.
But, is there a way to make a one-word symbol which is available project-wide, with no further effort?
Sorry if the question is trivial to Java experts! Cheers
Inicdentally I believe there are other approaches (example) to singletons in Java; above I pasted in the standard code supplied by Android Studio.