title: What is the Difference between onRestart() and onStart()
body: <p>Here i am trying to run a timer and its working fine, But my confusion is between <code>onRestart()</code> and <code>onStart()</code> method both are working same for me even after rotating the device, where in <code>Head First Android book</code> it is stated that:</p>
  
  <blockquote>
    <p>" : When you rotate the device, the activity is destroyed and a new one is created in its place. If we’d put code in the onRestart() method
    instead, it wouldn’t have run when the activity was re-created. The <code>onStart()</code> method gets called in both situations."</p>
  </blockquote>
  
  <p>Can please anyone help to clarify this. </p>
  
  <pre><code>private int seconds = 0;
      private boolean running = false;
      private boolean wasRunning = false;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_stop_watch_revision);
          if(savedInstanceState!=null){
  
              seconds = savedInstanceState.getInt("seconds");
              running = savedInstanceState.getBoolean("running");
              wasRunning = savedInstanceState.getBoolean("wasRunning");
  
          }
          runningTime();
      }
      public void onSaveInstanceState(Bundle sv){
  
          sv.putInt("seconds",seconds);
          sv.putBoolean("running",running);
          sv.putBoolean("wasRunning",wasRunning);
  
      }
  
      public void onStop(){
  
          super.onStop();
          wasRunning = running;
          running = false ;
  
  
      }
  
  
      public void onStart() {
  
          super.onStart();
          if (wasRunning) {
              running = true;
          }
      }
    /*Removing the onStart() method and adding the onRestart() method gives the same result*/ 
  
      public void onRestart() {
  
          super.onRestart();
          if (wasRunning) {
              running = true;
          }
      }
  
      public void runningTime() {
  
          final TextView txt_time = (TextView) findViewById(R.id.txt_time);
          Handler handler = new Handler();
          handler.post(new Runnable() {
  
              public void run() {
  
                  int hours = seconds / 3600;
                  int mins = (seconds % 3600) / 60;
                  int secs = seconds % 60;
                  String time = String.format("%d:%02d:%02d", hours, mins, secs);
                  txt_time.setText(time);
  
                  if (running) {
  
  
                      seconds++;
                  }
  
                  new Handler().postDelayed(this, 1000);
              }
  
  
          });
  
      }
  </code></pre>