title: Overriden onStop() and onRestart() call correctly but will not do following code
body: <p>I am currently working on a Game in Android Studio that combines Java and Android. </p>
  
  <p>My problem: When I close the App, wait for a few seconds and return to the App, it still runs in the background.
  This causes Game Objects to continue moving which always results in Game Over obviously.</p>
  
  <p>I implemented a "Pause" Function / Method in my Game, that can be accessed via a Pause Button, but also should get called when I close the app.
  This should pause the game when I close the app and be paused when I return to my app.</p>
  
  <p>I also implemented a "Resume" Function / Method to get out of the pause screen, that should also be called when I re-enter my app.</p>
  
  <p>Both methods "public void pause()" and "public void resume()" get called correctly when my activity provokes the onStop() and onRestart() methods but they do not do what they normally do when called via the pause button.</p>
  
  <p>I tested this with a simple System.out.println(""); 
  This showed me that my pause() and resume() methods get called when I close or re-enter my app. But they don't actually do the logic behind them (pause the game)</p>
  
  <p>My MainActivity Class</p>
  
  <pre><code>public class MainActivity extends Activity {
  protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
  scene = new GameplayScene();
  
  @Override
      protected void onStop() {
          super.onStop();
          scene.pause(); //
          System.out.println("stopped"); //testing purposes
      }
  
      @Override
      protected void onRestart() {
          super.onRestart();
          scene.resume();
          System.out.println("restarted"); //testing purposes
      }
  }
  </code></pre>
  
  <p>And my GamePlayScene Class</p>
  
  <pre><code>public void pause() {
          System.out.println("Pause Method Called");//works
          paused = true;
          timeScale = 0; //this freeze all movement (game pause)
  
          pauseImg = bf.decodeResource(Constants.CURRENT_CONTEXT.getResources(), R.drawable.resumesymbol);
      }
  
      public void resume() {
          System.out.println("Resume Method Called");
          paused = false;
          timeScale = 1; //this unlocks every movement again (game resume)
          touchable = true;
  
          pauseImg = bf.decodeResource(Constants.CURRENT_CONTEXT.getResources(), R.drawable.pausesymbol);
      }
  </code></pre>
  
  <p>As I said: Every method necessary gets called correctly.</p>
  
  <p>I/System.out: Pause Method Called
  I/System.out: stopped</p>
  
  <p>I/System.out: Resume Method Called
  I/System.out: restarted</p>
  
  <p>Why does it not actually pause the Game but instead keeps moving the objects?</p>
  
  <p>EDIT:</p>
  
  <p>My Button is just a Rect, 100x100 pixels that floats in the top right corner.
  The Button is displayed via a Bitmap of a pausebutton.png and I check if the Button has been pressed by the following:</p>
  
  <pre><code>public void pause(float touchX, float touchY) {
          if (pauseRect.contains((int)touchX,(int) touchY)) {
              paused = true;
              timeScale = 0;
  
              pauseImg = bf.decodeResource(Constants.CURRENT_CONTEXT.getResources(), R.drawable.resumesymbol);
          }
      }
  </code></pre>
  
  <p>This is the pause method for the button.
  This method gets called by the user on the physical button - the other pause method you see above should get called by closing the app (which works perfectly fine, but at the moment it's getting closed it does not do the other stuff inside the method)</p>
  
  <p>What the method does in detail:
  sets the boolean paused = true;
  sets int timeScale = 0 </p>
  
  <p>The gameloop always calls update() on every frame for my player class, where in this update() method it sets the speed * timeScale resulting in a stop of motion when timeScale = 0.</p>
  
  <p>This all works fine with my pause button but not with onRestart() </p>