Niftygui touch event problem? on android

I am experimenting using niftygui in an android app and I am having a problem.

I am using a slightly modified and hellojme.xml.

I have changed it to have a mouse click on the panel cause a change of the text in the panel.

The mac version does exactly what I would expect, i.e., a click on the panel changes the text.

The android app requires that I do a touch and move into the panel and then touch two more times to get the text to change.

Code is following:


public class Main extends SimpleApplication implements ScreenController {

private Nifty nifty;

public static void main(String[] args){

Main app = new Main();




public void simpleInitApp()


Box b = new Box(Vector3f.ZERO, 1, 1, 1);

Geometry geom = new Geometry(“Box”, b);

Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setTexture(“m_ColorMap”, assetManager.loadTexture(“Interface/Logo/Monkey.jpg”));



NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,




nifty = niftyDisplay.getNifty();

nifty.fromXml(“Interface/hellojme.xml”, “start”);

// attach the nifty display to the gui view port as a processor


// disable the fly cam



public void bind(Nifty nifty, Screen screen)


this.nifty = nifty;

Screen myScreen = nifty.getCurrentScreen();

System.out.println("Enter Bind - screen = " + myScreen);


public void onStartScreen()


System.out.println(“Enter onStartScreen”);


public void onEndScreen()


System.out.println(“Enter onEndScreen”);


public void sayHello(String myarg)


System.out.println("Nifty says "+myarg);

Element niftyElement = nifty.getCurrentScreen().findElementByName(“myText”);

niftyElement.getRenderer(TextRenderer.class).setText(“New text”);



<?xml version="1.0" encoding="UTF-8"?>

Oops, the xml didn’t show up. What do I have to do to get the xml visible?


use the java button at the top of the posing gui, and put your code xml whatever there, then it will not be changed.

[java]<?xml version="1.0" encoding="UTF-8"?>


<screen id="start" controller="mygame.Main">

<layer id="layer" backgroundColor="#0000" childLayout="center">

<panel id="panel" height="25%" width="35%" align="center" valign="center" backgroundColor="#f60f" childLayout="center" visibleToMouse="true">

<text id="myText" font="Interface/Fonts/Baskerville25.fnt" color="#000f" text="Menu" align="center" valign="center" />

<interact onClick="sayHello(hi)"/>