Hi everybody! What im trying to do is to attach an appstate from another appstate but it bring me an nullpointer exception.
My code is something like this:
[java]
public void goArcadeState() {
stateManeger.detach(this); //Detach he active state
ArcadeState Arcade = new ArcadeState (this.app, this.nifty); //Create a AcadeState to atachit,
stateManager.attach(ArcadePlayerSelect); //This is where i get nullpointer :S
}
[/java]
This method is called by a nifty button. What im doing wrong? Wich is the best way of doing this?
[java]
public void goArcadeMode() {
ArcadeState arcade = new ArcadeState(this.app, this.nifty);
stateManager.attach(arcade);
stateManeger.detach(this);
} [/java]
the error is:
java.lang.NullPointerException
at ScreenControllers.ControllerMenuPrincipal.goArcadeMode(ControllerMenuPrincipal.java:145)// the line3 in the code ive put here.
Looks like you are using an unintialized application. Like maybe you extended your class from SimpleApplication thinking you can access things like the assetManager etc. then, as if Java was a script language like PHP.
@normen said:
Looks like you are using an unintialized application. Like maybe you extended your class from SimpleApplication thinking you can access things like the assetManager etc. then, as if Java was a script language like PHP.
The class im calling is this:
[java]
public class ArcadeState extends AbstractAppState implements ScreenController
[/java]