javalibgdxdialog

LIBGDX - issue on dialog closure


I have DialogActor which extends the LIBGDX dialog class. When I initiate an instance it shows the dialog as expected with the correct functionality for Resume, Top5 and Quit buttons. When I select "Top 5" another LIBGDX dialog object is created correctly. However when I exit this object I see the first dialog object (as expected) but cannot select "Resume" or "Quit". I guess the button click has already been consumed. How do I get around this?

public DialogActor(String pTitle, Skin pSkin){
    super(pTitle, pSkin);

    button("Resume", "Resume");
    button("Top 5", "Top 5");
    button("Quit", "Quit");

}

@Override
protected void result(final Object object){
    if (object == "Resume") {
        remove();
    } else if (object == "Top 5"){
        Top5Dialog top5Dialog = new Top5Dialog("", skin);
        top5Dialog.show(stage);
    } else if (object == "Quit"){
        int pid = android.os.Process.myPid();
        android.os.Process.killProcess(pid);
        System.exit(0);
    }
}

Solution

  • By default, the first dialog is hidden after a button click unless you call com.badlogic.gdx.scenes.scene2d.ui.Dialog#cancel. Not sure if you do that here.

    In your case, the dialog is still there but doesn't react anymore. My guess would be that hide has been triggered which I think removed the listeners. Maybe you don't call stage.act() in your render loop which might cause the dialog not finishing its fadeout animation and still appear visible.