Android: onSaveInstanceState() and onPause()
<p>I'm a little bit confused about these two methods in Android. </p>

<p>From the documentation I understand that <code>onSaveInstanceState()</code> should be called to store only temporary information, and <code>onPause()</code> should be used to store any persistent data. </p>

<p>I was wondering why to call <code>onSaveInstance()</code> at all, when <code>onPause()</code> is called every time. Then I read in the Notepad tutorial : </p>

<blockquote>
  <p>"Note that <code>saveState()</code> must be
  called in both <code>onSaveInstanceState()</code>
  and <code>onPause()</code> to ensure that the
  data is saved. This is because there
  is no guarantee that
  <code>onSaveInstanceState()</code> will be called
  and because when it is called, it is
  called before <code>onPause()</code>."</p>
</blockquote>

<p>There is no guarantee that <code>onSaveInstanceState()</code> will be called because you can simply walk out of the activity using the back button. </p>

<p>But according to this if you don't save the persistent data inside both methods, the app might be killed while inside <code>onSaveInstanceState()</code>. </p>

<p>So we need to save the persistent data in both methods actually, am I right ?</p>

<p>But if this is true, isn't this too much of an overhead and maybe there should be some other additional flag to tell if the method is already called or something ?  </p>

<p><a href="http://developer.android.com/resources/tutorials/notepad/notepad-ex3.html">http://developer.android.com/resources/tutorials/notepad/notepad-ex3.html</a></p>
