Nifty terrible to use with Android

I am trying to use nifty with Android and I am getting :

  1. Almost 10 secs of “loading” beteween screen to screen ( in pc there is no loading )
  2. User can multiple click on btns and it seens there is nothing you can do other then putting flags for each action…
  3. Unknow null pointer exception on nifty classes.
  4. Unknow null pointer exception on the inputmanager ( I dont know even how its happpening )

About item 3 :

at mygame.AppStateGamePhaseRun.onAction(
at com.jme3.input.InputManager.invokeActions(
at com.jme3.input.InputManager.onMouseButtonEventQueued(
at com.jme3.input.InputManager.processQueue(
at com.jme3.input.InputManager.update(
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(

The line of code with null :


obs: Main.ref_inputManager is not null , but the getcursorposition is …
I did notice its happening because I am using nifty.exit() to close all nifty stuff before the games beguins.
I did notice after some frames the inputManager normalizes…

How can this library nulify the inputManager ???
There is anyone using nifty with success on android ?


I used Nifty on my first game on android devices including consoles and I had few issues making it run on it. Nifty batching on Android is a definite No, it brings more problems that it wants to solve.

I don’t call Exit at all, I prefer to either hide the layers/panels or change the nifty screen to an empty one. I have one class that initializes Nifty and is an app state, I have also controller classes that controls just the screens. I keep this app state at all times and never clean it until the very end, I manage the screens and controllers with it.

Thanks for your tips !
Its an good tip to hide the panels, it may fix my null pointers problems…
But doing that, I guess you use much more memory of what you should because of textures etc, how do you handle it do you dispose it and recreate on the screen initialization ?
If so, and also, are you getting an annoying delay of several seconds when doing the nifty.fromXml load ?
I am filling that there is no way to go, or we use much more memory keeping nifty and all the screens in memory or we have to wait several seconds to change from screen to screen … Thats is very bad, for me it makes nifty useless, because android is already very slow, and have little memory…

about GUI textures I keep them to a minimum size and take advantage of the image mode to stretch the image to any size, and when you hide panels they are no longer taken into account into the rendering phase so you have yourself a boost.

Yes, loadFrom xml can take time and even more it you use batching, so for Android keep it default. Also, do not have one huge xml with all the screens, you can load one and add more with the addXml method. Nifty only renders one screen at a time and forgets about the rest, keeping the memory low even if you change screens. It takes time trying to find the best setup but it pays well in the end.