Nifty gotoScreen takes more than a minute to work on Android

Hey guys,

I am trying to make a hud for my Android game (using xml), but the problem is, that when I do nifty.gotoScreen it takes almost a minute before I see the effect taking place:

[java]nifty.gotoScreen(“hud”);[/java]

What I tried is removing all elements from my xml file:

[java]<screen id=“hud” controller=“ufoblaster.Main”></screen>[/java]

and disable nifty logging in my SimpleApplication class:

@Override
public void start() {
super.start(); //To change body of generated methods, choose Tools | Templates.
Logger.getLogger(“de.lessvoid.nifty”).setLevel(java.util.logging.Level.OFF);
Logger.getLogger(“NiftyInputEventHandlingLog”).setLevel(java.util.logging.Level.OFF);
}

but even that didn’t work.

Does anyone know how to solve this problem?

you are giving us almost no information, so we dont know anything

@Ascaria

Sorry. I could also post my whole set of classes, but that would make this topic hard to read. I’ll check if I can post some more detail later.

What I also noticed is that this only happens loading a scene for the first time and trying to switch screens afterwards.

So I assume, no one else has this problem on Android? On pc it just works fine.

i can only suggest you to clear the hud, create only one panel in it, without any controller. if this will be loaded fast, you have starting point for finding bottle neck

noone posting in this topic, because you practically said “i have problem, my code is huge therefore i dont post it here, help me”

if you want good responses, you must give us enough data, we are blind with current ones.

grab your code, throw away things that does not influence your current problem. create minimalistic demo code which takes long time to load and show us. or better, with that demo, you could be able to solve it yourself.

edit: you could also replace nifty with tonegodgui… its “jme3-native”… nifty is standalone and huge.

do nifty.addXML() (and nifty.registerController()) on all of your necessary screens at startup. Any goto’s after that should be fast

Thanks for your help guys,

I think I found the problem. I don’t really understand how this is possible since I use the loading screen to inform that the scene is loaded, but the fact that it took too long to switch, was because the way my scene was set up.

Seems Android isn’t happy with too much linked objects. (15 linked objects and a skybox)