title: how to wait until a fragment is removed
body: <p>I have an activity with dynamic fragments in it. I need to run some code <strong>after</strong> a fragment is removed but <code>remove(myFragment).commit()</code> is executed asynchronously and i cant know when exactly the fragment is removed.Here is my code:</p>
  <pre><code>final FragmentTransaction ft = getFragmentManager().beginTransaction();
  ft.remove(myFragment).commit();
  //wait until the fragment is removed and then execute rest of my code
  </code></pre>
  <p>From the documentation:</p>
  <blockquote>
  <p>public abstract int <strong>commit ()</strong></p>
  <p>Schedules a commit of this transaction. The commit <strong>does not</strong> happen
  immediately; it will be scheduled as work on the main thread to be
  done the next time that thread is ready.</p>
  </blockquote>