title: How can I call fragmentactivity in mainactivity (AppCompactActivity)
body: <p>How to access FragmentActivity in MainActivity (AppCompactActivity)</p>
  
  <p>here is my FragmentActivity:</p>
  
  <pre><code>public class MainFragment extends FragmentActivity {
  
  private Fragment contentFragment;
  HomeFragment homeFragment;
  ProductDetailFragment pdtDetailFragment;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      FragmentManager fragmentManager = getSupportFragmentManager();
  
      if (savedInstanceState != null) {
          if (savedInstanceState.containsKey("content")) {
              String content = savedInstanceState.getString("content");
              if (content.equals(ProductDetailFragment.ARG_ITEM_ID)) {
                           if(fragmentManager.findFragmentByTag(ProductDetailFragment.ARG_ITEM_ID) != null) {
                      contentFragment = fragmentManager
                              .findFragmentByTag(ProductDetailFragment.ARG_ITEM_ID);
                  }
              }
          }
          if (fragmentManager.findFragmentByTag(HomeFragment.ARG_ITEM_ID) != null) {
              homeFragment = (HomeFragment) fragmentManager
                      .findFragmentByTag(HomeFragment.ARG_ITEM_ID);
              contentFragment = homeFragment;
          }
          } else {
          homeFragment = new HomeFragment();
          switchContent(homeFragment, HomeFragment.ARG_ITEM_ID);
          }
          } 
  </code></pre>
  
  <p>Here is My MainActivity Which Extends AppcompactActivity:</p>
  
  <pre><code> public class MainActivity extends AppCompatActivity {
  
       //How to i use FragmentActivity in MainActivity
   }
  </code></pre>