Here is Java code:
[java]
public class Main extends SimpleApplication implements Savable, ScreenController, Controller {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
private String str;
…
public void onAction(String name, boolean keyPressed, float tpf) {
…
str= closest.getGeometry().getName();
System.out.println(“INITIALIZED HERE” + str); //debug attached below
}
public String getName() {
System.out.println(“ALREADY INITIALIZED???” + str); //debug attached below
return str + “OLOLOLOLO”;
}
…
}
[/java]
According to this code I have got on my Nifty screen “nullOLOLOLOLO”. On debugging log I’ve got:
…
line 152: INITIALIZED HEREdragon // (looks nice)
…
line 267: ALREADY INITIALIZED???null //
You probably haven’t given nifty the SimpleApplication as a ScreenController so it’s created a new blank one. Register the screen controller before switching to the screen.