setBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
final Dialog dialog = new Dialog("Settings", skin, "dialog") {
public void result(Object obj) {
Preferences prefs = Gdx.app.getPreferences("My Preferences");
if (obj.equals(2))
muteMusic = true;
if (obj.equals(3))
muteMusic = false;
prefs.putBoolean("music", muteMusic);
prefs.flush();
}
};
dialog.text("Do you want to play music");
dialog.button("Yes", 2); //sends "true" as the result
dialog.button("No", 3); //sends "false" as the result
dialog.button("Ok", false);
dialog.show(stage);
}
});
- I want the ok button to be on an another row but if I do
dialog.row()
like with tables, it won't work, I can't add an empty row - I want the dialog to stay visible on the screen until the ok button is touched, only then I want to call
dialog.hide()
I can't do
if (obj.equals(false))
dialog.hide(); // IDE will suggest that i create a local variable called dialog