title: When to use the attach and detach methods of FragmentTransaction
body: <p>I just went through the documentation of the <code>attach()</code> and <code>detach()</code> methods of <code>FragmentTransaction</code>:</p>
  
  <blockquote>
    <p><code>attach()</code>: Re-attach a fragment after it had previously been detached from the UI with <code>detach(Fragment)</code>. This causes its view hierarchy to be re-created, attached to the UI, and displayed.</p>
  </blockquote>
  
  <p>Well, what does that mean?</p>
  
  <ol>
  <li><p>More specifically, I saw an example:</p>
  
  <pre><code>mMapFragment = new MapFragment();
  ft.beginTransaction(mMapFragment)
    .attach()
    .add(R.id.container, mMapFragment)
    .commit();
  </code></pre>
  
  <p>I deleted the <code>attach()</code> and tried again: I did not notice any difference. What does the <code>attach</code> do in this example? What is the difference compared to this:</p>
  
  <pre><code>ft.beginTransaction()
    .add(R.id.container, mMapFragment)
    .commit();
  </code></pre></li>
  <li><p>In case the example above is not good enough to show the difference... I just want to know when do we need to call the <code>attach()</code> and <code>detach()</code> explicitly? It would be better if you can explain the difference with respect to add/remove/replace.</p></li>
  </ol>