title: Get Fragment dynamically attached to <FrameLayout>?
body: <p>Well, i got a simple <code>&lt;FrameLayout&gt;</code>:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/FragmentContainer"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  </code></pre>
  
  <p>Then in my code, i added a Fragment to it:</p>
  
  <pre><code>FragClass aFrag = new FragClass();
  getSupportFragmentManager().beginTransaction()
          .replace(R.id.FragmentContainer, aFrag).commit();
  </code></pre>
  
  <p>And somewhere else in my code, i want to get that <code>FragClass (extends Fragment)</code> object from the ID <code>R.id.FragmentContainer</code>.</p>
  
  <p>i have tried</p>
  
  <pre><code>((ViewGroup) findViewById(R.id.FragmentContainer)).getChildAt(0)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>((FrameLayout) findViewById(R.id.FragmentContainer)).getChildAt(0)
  </code></pre>
  
  <p>but they are returning the <code>View</code>, instead of the <code>Fragment</code> attached to it.</p>
  
  <p><em>i know i can keep the variable <code>aFrag</code> somewhere, so i do not need to find it again. But i believe there should be a way to retieve it.</em></p>