title: Get Fragment instance in Activity
body: <blockquote>
    <p>I have added Fragment to Activity like</p>
  </blockquote>
  
  <pre><code>getSupportFragmentManager().beginTransaction()
                      .add(R.id.container,new MyFragment).commit();
  </code></pre>
  
  <p>where <code>container</code> is the id of <code>FrameLayout</code></p>
  
  <pre><code> &lt;FrameLayout
              android:id="@+id/container"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  </code></pre>
  
  <p>Now how could i get the instance of <strong>Fragment in Activity</strong> <a href="https://stackoverflow.com/questions/8532462/how-to-get-the-fragment-instance-from-the-fragmentactivity">like this</a></p>
  
  <p>I have to call a method of <code>Fragment A</code> after getting result from <code>Fragment B</code>.</p>
  
  <p>I have created an interface in Fragment B and implemented it in Activity.Now i have to pass the result to Fragment A. I am unable to get the instance of Fragment A. </p>
  
  <blockquote>
    <p>One thing i don't wanna do is to create a private instance of <strong>Fragment A</strong> in <strong>Activity</strong> and call it's method.</p>
  </blockquote>