title: How to pause/resume a fragment
body: <p><em>Background:</em> I wrote a custom container which is capable of holding three fragments. Depending on the state of this container only two or those three fragments are visible. To inform fragments that their visibility was changed I tried out two options:</p>
  
  <ol>
  <li><p>I called <a href="http://developer.android.com/reference/android/support/v4/app/Fragment.html#setUserVisibleHint%28boolean%29" rel="noreferrer">Fragment.setUserVisibleHint()</a> method with respective value. Hosted fragments overrode this method and react appropriately. This worked out.</p></li>
  <li><p>I called <a href="http://developer.android.com/reference/android/app/FragmentTransaction.html#hide%28android.app.Fragment%29" rel="noreferrer">FragmentTransaction.hide()</a> and <a href="http://developer.android.com/reference/android/app/FragmentTransaction.html#show%28android.app.Fragment%29" rel="noreferrer">FragmentTransaction.show()</a> methods to hide and show fragments. Hosted fragments overrode Fragment.onHiddenChanged() and reacted as needed. This worked out as well.</p></li>
  </ol>
  
  <p>My problem is that I am not satisfied with either of these options. I would like to put invisible fragment into a standard <em>paused</em> state. Advantage of this option is that I keep the code clean and simple, as I don't need to override any special methods (like <code>setUserVisibleHint()</code> or <code>onHiddenChanged()</code>) and I can handle everything inside <code>onPause()</code> and <code>onResume()</code> which are already implemented.</p>
  
  <p><em>Question:</em> What is the proper way to put a fragment into a <em>paused</em> state and then to resume it from that state?</p>
  
  <p><strong>Update:</strong> I tried out <code>FragmentTransaction.detach()</code> too. This is not an option because it destroys the view, which is not allowed in my case.</p>