title: getSupportFragmentManager() undefined in adapter when using AppCompatActivity
body: <p>I have an activity (MainActivity) which extends AppCompatActivity because I am using some of the material design elements in my app.</p>
  
  <p>I then have an array adapter with a few fields and a button. This adapter has a separate view and is injected into my MainActivity layout. </p>
  
  <p>When I click the button on the adapter view, I want to open a new fragment which displays a bunch of text, however, I can't seem to do this and I think it is because I am not extending FragmentActivity in my MainActivity? I read on another post that I should be able to extend AppCompatActivity and still be able to reference the fragment manager...here is my code to open the fragment:</p>
  
  <p>In my custom array adapter, onClick() of a button:</p>
  
  <pre><code>holder.desc.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        JobDescFragment fragment= new JobDescFragment();
        FragmentTransaction transaction =      getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.fragment_container, fragment);
        transaction.addToBackStack(null);  
        transaction.commit();
    }
  });
  </code></pre>
  
  <p>The error I get is that it cannot resolve getSupportFragmentManager(). What am I doing wrong? </p>
  
  <p>I am importing android.support.v4.app.Fragment and .FragmentManager in my adapter.</p>
  
  <p>Thanks in advance for the help!</p>
  
  <h2>EDIT:</h2>
  
  <pre><code>&lt;merge
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"&gt;
  
      &lt;com.lorentzos.flingswipe.SwipeFlingAdapterView
          android:id="@+id/frame"
          android:background="@color/laborswipe_lightgray"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          tools:context=".MainActivity"
          android:layout_gravity="top"   /&gt;
  
      &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/fragment_container"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/merge&gt;
  </code></pre>