title: Show different menu options on Toolbar for activity and fragment
body: <pre><code>Android Studio 1.4
  </code></pre>
  
  <p>I have a Toolbar that I inflate in my <code>activity_main.xml</code>.
  I have a menu called <code>main.xml</code> that gets inflated that has just 1 icon to display on it.</p>
  
  <p>When the user clicks to open a fragment. I have another menu <code>friends.xml</code> that has 2 icons.</p>
  
  <p>When I inflate the friends menu in the fragment it still displays the icon from the <code>main.xml</code> menu.</p>
  
  <p>I thought that inflating a new menu on the toolbar would remove the existing menu.</p>
  
  <p>This is a screenshot of the main.xml menu. The find icon is displayed
  <a href="https://i.stack.imgur.com/KdZGf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KdZGf.png" alt="enter image description here"></a></p>
  
  <p>This is the screenshot of the fragment as you can see the find icon is still there.</p>
  
  <p><a href="https://i.stack.imgur.com/DiPPJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DiPPJ.png" alt="enter image description here"></a>
  <code>activity_main.xml</code> with toolbar included</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout
      android:id="@+id/drawer_layout"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/white"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
          &lt;include
              android:id="@+id/tbMain"
              layout="@layout/app_bar"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"/&gt;
  
          &lt;FrameLayout
              android:id="@+id/content_frame"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:clickable="true"/&gt;
      &lt;/LinearLayout&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>here is my code for create the menu in MainActivity.java</p>
  
  <pre><code>    private void setupToolBar() {
          mToolbar = (Toolbar)findViewById(R.id.tbMain);
          setSupportActionBar(mToolbar);
  
          getSupportActionBar().setHomeButtonEnabled(true);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      }
  
   @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          return super.onOptionsItemSelected(item);
      }
  </code></pre>
  
  <p>And in my fragment I have this, as you can see I am inflating the friends.xml menu.</p>
  
  <pre><code>  @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          super.onCreateOptionsMenu(menu, inflater);
          inflater.inflate(R.menu.friends, menu);
      }
  </code></pre>
  
  <p>Many thanks for any suggestions,</p>