title: How to control Activity FragmentTransaction from within a fragment?
body: <p>Im sure this question is pretty basic but im new.
  Now I have a FragmentTransaction under my main activity (see it below), I would like to be able to perform "replace" from within one of these fragments. I believe it would involve getActivity() but im not really sure about how to do that?</p>
  
  <p>It would be nice if anybody could give me an example, thanks in advance :)</p>
  
  <pre><code>public void onTabSelected(Tab tab, FragmentTransaction ft) {
      {
          if(tab.getPosition()==0)
          {
          firstFragment frag = new firstFragment();
          ft.replace(android.R.id.content, frag);
          }
          else if(tab.getPosition()==1)
          {
          newsFragment frag = new newsFragment();
          ft.replace(android.R.id.content, frag);
          }
          else if(tab.getPosition()==2)
          {
          thirFragment frag = new thirFragment();
          ft.replace(android.R.id.content, frag);
          }
          else if(tab.getPosition()==3)
          {
          calendar frag = new calendar();
          ft.replace(android.R.id.content, frag);
          }
          else if(tab.getPosition()==6)
          {
          linksFragment frag = new linksFragment();
          ft.replace(android.R.id.content, frag);
          }
          else if(tab.getPosition()==5)
          {
          contactFragment frag = new contactFragment();
          ft.replace(android.R.id.content, frag);
          }
          }
  
  
  }
  </code></pre>