title: Saving Activity State in the onPause
body: <p>I have a variable that I have successfully saved and restored using onSaveInstanceState</p>
  
  <pre><code>@Override
  protected void onSaveInstanceState(Bundle outState) {
      super.onSaveInstanceState(outState); // the UI component values are saved here.
      outState.putDouble("VALUE", liter);
      Toast.makeText(this, "Activity state saved", Toast.LENGTH_LONG).show();
  }
  </code></pre>
  
  <p>But this only works if the activity is destroyed.  I want to save the same variable by overriding the onPause() method and getting back when the activity is not not paused anymore any ideas on how to do this are greatly appreciated</p>