You have to overwrite the keyDownkeyDown function in Stage.
Example code :
mStage = new Stage() { @Override public boolean keyDown(int keyCode) { if (keyCode == Keys.BACK) { Gdx.app.exit(); } return super.keyDown(keyCode); } }; Gdx.input.setInputProcessor(mStage); Gdx.input.setCatchBackKey(true);See this example code
mStage = new Stage() {
@Override
public boolean keyDown(int keyCode) {
if (keyCode == Keys.BACK) {
Gdx.app.exit();
}
return super.keyDown(keyCode);
}
};
Gdx.input.setInputProcessor(mStage);
Gdx.input.setCatchBackKey(true);