title: How do I get this timer to update after screen rotates?
body: <p>When I rotate the screen, the timer is destroyed and not re-created. For some reason, during the activity life-cycle, the timer does not resume to its state after the screen rotates.</p>
  
  <pre><code>@Override
  public void onStart(){
      super.onStart();
      Log.d(CLASS_NAME, "onStart");
  
      if (timerRunning) {
  
          Log.d(CLASS_NAME,"This should give a new handler and UPDATE TIMER");
  
          handler = new Handler();
          updateTimer = new UpdateTimer();
          handler.postDelayed(updateTimer, UPDATE_EVERY);
      }
  }
  </code></pre>
  
  <p>What I think the problem might be is that when the activity is destroyed when the screen rotates, the timerRunning becomes false, so it never reaches the if statement in onStart(). </p>
  
  <pre><code>@Override
  public void onPause(){
      super.onPause();
      Log.d(CLASS_NAME, "onPause");
  }
  @Override
  public void onResume(){
      super.onResume();
      Log.d(CLASS_NAME, "onResume");
  
      enableButtons();
  
      Log.d(CLASS_NAME, "re-setting time display");
      setTimeDisplay();
  }
  @Override
  public void onStop(){
      super.onStop();
      Log.d(CLASS_NAME, "onStop");
  
      if (timerRunning){
  
          Log.d(CLASS_NAME, "HERE ON STOP SHOULD REMOVE CALLBACKS");
  
          handler.removeCallbacks(updateTimer);
          updateTimer = null;
          handler = null;
      }
  }
  
  @Override
  public void onDestroy(){
      super.onDestroy();
      Log.d(CLASS_NAME, "onDestroy");
  }
  @Override
  public void onRestart(){
      super.onDestroy();
      Log.d(CLASS_NAME, "onRestart");
  }
  
  class UpdateTimer implements Runnable {
  
  
      public void run() {
  
          //Log.d(CLASS_NAME, "run");
  
          setTimeDisplay();
  
          if (handler != null) {
              handler.postDelayed(this, UPDATE_EVERY);
          }
      }
  }
  </code></pre>
  
  <p>When I rotate the screen, the lifecycle looks like this: </p>
  
  <pre><code>Clicked Start Button
  Set Buttons Enabled/Disabled
  //Rotate screen
  onPause
  onStop
  HERE ON STOP SHOULD REMOVE CALLBACKS
  onDestroy
  Set Buttons Enabled/Disabled
  Setting Text
  onStart
  onResume
  Set buttons enabled/disabled
  re-setting time display
  </code></pre>
  
  <p>it seems like onDestroy is getting called when I want onResume? </p>