I have a UI with four Screens (all extending a "main Screen") that users switch between very frequently, at the moment I am switching Screens using
g.setScreen(new screen);, but this leads to the problem that I have to reload and initialize everything inside the Screen every single time, which is causing memory leaks.
Is there some way I can save the Screens in memory and just load them without having to re-initialize everything inside them? Or is this bad? Because my current approach is not going to cut it.
I was thinking something like initializing all Screens on startup and saving them in an array, then just loading the Screen I need from that array when I need it, ie
g.setScreen(screenArray.get(nextScreen));. Is this a viable approach? Please any advice you can give will help, really need help with this.