How can I maintain state when switching between action bar tabs / fragments?
<p>I have a number of fragments attached to the Android action bar as tabs. I can switch between them without problems. However, if one of the fragments has a <code>TextView</code> (for example), and I alter the text of that <code>TextView</code>, the new text is not kept if I switch to another tab and back. </p>

<p>I've tried overriding <code>onSaveInstanceState()</code>, but it appears it is not called when I switch tabs, as <code>savedInstanceState</code> is <code>null</code> every time <code>onActivityCreated()</code> is called (i.e. every time that tab is reopened). </p>

<p>I looked into altering <code>onPause()</code> such that it calls <code>onSaveInstanceState()</code>, but <code>onPause()</code> doesn't have access to the state bundle, so I don't see how I can do that.</p>

<p>What is the best way to keep state in a tab when going back and forth between tabs?</p>
