title: Using Toolbar with Fragments
body: <p>I am trying to create a viewpager that swipes through 3 different fragments each with a different toolbar. I have implemented the new toolbar in an activity before and got it to work however I am trying to get it to work with fragments</p>
  
  <p>Here is the fragment code</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      // Inflate the layout resource that'll be returned
      View rootView = inflater.inflate(R.layout.fragment_home, container, false);
  
  
      mToolbar = (Toolbar) rootView.findViewById(R.id.toolbar_home);
      if (mToolbar != null) {
          setSupportActionBar(mToolbar);
      }
      mToolbar.setTitle(null);
  
      return rootView;
  }
  </code></pre>
  
  <p>I am extending my fragment with <code>Fragment</code>, however I am getting the error</p>
  
  <pre><code>Cannot resolve method setSupportActionBar
  </code></pre>
  
  <p>I am not sure how to resolve this, if I remove the <code>setSupportActionBar</code> code will it stop working with certain devices?</p>