Skip to content Skip to sidebar Skip to footer

Pause And Dispose() Not Getting Called In Applicationlistener In Libgdx

when I am calling exit() method in onDestroy() method of AndroidApplication, the pause() and dispose() of ApplicationListener were not getting called. Can anyone help me on this.

Solution 1:

Got Resolved. While calling the listener from AndroidApplication and reverting back from it, I used to raise an Activity resulting that raised Activity was kept in pause. As of we know that paused can't be destroyed immediately. So dispose() was not called properly. Instead of raising activity, I used dialogue box, then there is a possibility of killing android application.

Solution 2:

For anyone who has similar problem with game screens:

example (i will wrote just necesary code for the problem not all which should be there):

We have Main class which we use as parent to all other screens.

publicclassMainextendsGame {
    public GameScreen gameScreen;
    publicvoidcreate(){
        gameScreen = new GameScreen(this);
        setScreen(gameScreen);  
    }  
}

So we have gameScreen running but its pause() and dispose() won't be working. That is becouse gameClass "is actually" Main class (just for easier describing). The pause() and dispose() methods that will be called are Main ones. So methods from parent (Main) will override gameScreen ones.

Hope it helps someone

Post a Comment for "Pause And Dispose() Not Getting Called In Applicationlistener In Libgdx"