title: onOptionsItemSelected not registering for items In Fragment
body: <p>I have a fragment with a <code>NavigationView</code> which is using a menu with three items. However, whenever I click the menu items, the <code>onOptionsItemSelected()</code> function is not called. </p>
  
  <p>This <code>NavigationView</code> is being used in a drawer and the <code>onOptionsItemSelected()</code> function works when opening and closing the drawer, just not when clicking the menu items.</p>
  
  <p>Any help would be appreciated, thanks.</p>
  
  <p><strong>Fragment Class:</strong></p>
  
  <pre><code>public class Navigation extends Fragment {
  
  private DrawerLayout mDrawerLayout;
  private ActionBarDrawerToggle mToggle;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setHasOptionsMenu(true);
  }
  
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.fragment_navigation, container, false);
  
      mDrawerLayout = (DrawerLayout) view.findViewById(R.id.drawerLayout);
      mToggle = new ActionBarDrawerToggle(getActivity(), mDrawerLayout, R.string.open, R.string.close);
  
      mDrawerLayout.addDrawerListener(mToggle);
      mToggle.syncState();
  
      ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
      return view;
  
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      //Opens and closes drawer
      if(mToggle.onOptionsItemSelected(item))
      {
          return true;
      }
  
      switch(item.getItemId())
      {
          case R.id.new_flight: Log.d("SELECTED", "new_flight");
              break;
          case R.id.saved_flight: Log.d("SELECTED", "saved_flight");
              break;
          case R.id.settings: Log.d("SELECTED", "settings");
              break;
          default:
              break;
      }
  
      return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p><strong>Fragment XML:</strong></p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      tools:context="com.example.craig.flightfinder.Navigation"
      android:id="@+id/drawerLayout"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
      &lt;/LinearLayout&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/mainNav"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:clickable="true"
          app:menu="@menu/navigation"&gt;&lt;/android.support.design.widget.NavigationView&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>