title: getSupportActionBar from inside of Fragment ActionBarCompat
body: <p>I'm starting a new project that uses the <code>AppCompat/ActionBarCompat</code> in <code>v7</code> support library. I'm trying to figure out how to use the <code>getSupportActionBar</code> from within a fragment. My activity that hosts the fragment extends <code>ActionBarActivity</code>, but I don't see a similar support class for Fragments.</p>
  
  <p>From within my fragment</p>
  
  <pre><code>    public class CrimeFragment extends Fragment {
            //...
  
            getActivity().getSupportActionBar().setSubtitle(R.string.subtitle); // getSupportActionBar is not defined in the v4 version of Fragment
  
            //...
      }
  </code></pre>
  
  <p>The google page for using it (<a href="http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html">http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html</a>) says there should be no changes for the <code>v4</code> fragment. Do I need to cast all my <code>getActivity()</code> calls to an <code>ActionBarActivity</code>? That seems like poor design.</p>