6
\$\begingroup\$

There are a lot of articles about how to save a state of a game and they are pretty good. But I have one conceptual misunderstanding where should I save the state?

My game has number of screens and pair of them are MainMenuScreen and MainSceneScreen these are inherited from Screen class. MainMenuScreen is shown at start of the game the MainSceneScreen little later.

What is the problem? I navigated to MainSceneScreen, forced Android to stop the application (I change a language settings on the device to achieve it, please let me know if I'm wrong). After that I select the application again and I can see MainMenuScreen is shown. But I want MainSceneScreen to be shown.

I suppose I should override resume method. But what class I should override? I have class PsGame that extends Game class of libgdx. I put breakpoints to its resume method and it turned out that method was not called. I investigated the problem and I've found little strange code in onResume method of AndroidApplication class of libgdx:

    if (!firstResume)
        graphics.resume();
    else
        firstResume = false;

My debugger said firstResume was true and didn't go to *graphics.resume()*line.

Sorry for a lot of words but could you answer following question:

  1. What did I do wrong?
  2. What methods should I override?

Thank you in advance.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I overrid resume() in the class tha extends Game in libgdx, and when i press the home button and enter the app again it executes and it enters that method \$\endgroup\$
    – Rudy_TM
    Jul 23, 2012 at 7:58
  • 1
    \$\begingroup\$ @Rudy_TM You should post this as an answer. \$\endgroup\$ Sep 14, 2012 at 15:21

1 Answer 1

1
\$\begingroup\$

I override resume() in the class tha extends Game in libgdx, and when i press the home button and enter the app again it executes and it enters that method.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .