title: How to get the FragmentManager by the views ID?
body: <p>How can I get the <code>FragmentManager</code> of a View?</p>
  
  <p>Assuming I have a layout like this:</p>
  
  
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  ...
  &lt;fragment android:name="com.example.MyFragment"
          android:id="@+id/thefragmentsid" &gt;
  &lt;/fragment&gt;
  ...
  </code></pre>
  
  <p>Here is my pseudo code (I know that not even <code>FragmentView</code> exists, but I guess you know what I mean)</p>
  
  <pre class="lang-java prettyprint-override"><code>FragmentView fw = (FragmentView) activity.findViewById( R.id.thefragmentsid );
  FragmentManager goal = fw.getFragment().getFragmentManager();
  </code></pre>
  
  <p>And here is an example use case:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MyFragment extends Fragment{
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate( R.layout.my_fragments_view, container, false );
      }
  }
  
  public class MainActivity extends FragmentActivity{
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          findViewById( R.id.thefragmentsid ).setOnTouchListener( new OnTouchListener(){
              @Override
              public boolean onTouch( View v, MotionEvent event ){
                  FragmentView fw = (FragmentView) findViewById( R.id.thefragmentsid );
                  FragmentManager fm = fw.getFragment().getFragmentManager();
                  // Do something with the fragment manager
                  return false;
              }
          } );
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> I do not have access to any <code>Fragment</code>-Object in any way I know. Maybe there is a hidden way but exactly for that I'm asking!</p>
  
  <p><strong>NEXT EDIT:</strong> (Just to complete the question afterwards) I'm using the Google Support Package! </p>
  
  <p>PS: I don't want to give too much involved infos because it's a general question which requires a general answer and could appear occasionally.</p>