Skip to main content

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);

You have to overwrite the keyDown 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);

You have to overwrite the keyDown function in Stage.

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);
Source Link

You have to overwrite the keyDown 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);