How to close a game that uses multiple Screen in LIbgdx

I have a class that extends Game, then a bunch of other classes that implements Screen and because of that I can just do this game.setScreen(new MyScreen(game)); but the problem is that when I do it just closes the current screen and go to the next one, this is the same for game.dispose().So how do you close or exit the game when it’s running as desktop or android application?


You could try doing System.exit(0), which should work.

I believe (although I haven’t tested this one out), you can also add the line: config.forceExit(false) whereas it was previously set to true.