title: onNavigationItemSelected not being called for Bottom Navigation Bar
body: <p>I'm trying to implement a bottom nav bar that changes fragments when the nav items are clicked. However, when I click on the nav bar items, the fragments don't change. Using <code>log.d</code>, I noticed <code>onNavigationItemSelected</code> is not being called. <strong>How do I fix this?</strong></p>
  
  <p>To note, the  <code>startFeedFragment</code>, <code>startScheduleFragment</code>, &amp; <code>startSettingsFragment</code>are implemented the same way and they work for the buttons in the toolbar. I also referenced this <a href="https://stackoverflow.com/a/36033640/7327018">tutorial</a> and this <a href="https://stackoverflow.com/a/42907387/7327018">question</a> for help.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {
  
  protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          setUpRecycler();
          startFeedFragment();
  
          BottomNavigationView bottomNavBar = (BottomNavigationView) findViewById(R.id.navigation);
          bottomNavBar.bringToFront();
          bottomNavBar.setOnNavigationItemSelectedListener(this);
      }
  
      @Override
      public boolean onNavigationItemSelected(@NonNull MenuItem item) {
          Log.d("NAV BAR", "onNavigationItemSelected hit");
          switch (item.getItemId()) {
              case R.id.feedMenu:
                  startFeedFragment();
                  Log.d("NAV BAR", "feed");
                  break;
              case R.id.myScheduleMenu:
                  startScheduleFragment();
                  Log.d("NAV BAR", "schedule");
                  break;
              case R.id.settingsMenu:
                  startSettingsFragment();
                  Log.d("NAV BAR", "settings lol");
                  break;
              default:
                  Log.d("NAV BAR", "false");
                  return false;
          }
          return true;
      }
  
     /**
       * Switches out the fragment for {@link FeedFragment} and sets an appropriate title. startScheduleFragmens &amp; startSettingsFragment are implemented the same way
       */
      private void startFeedFragment()
      {
          FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
          transaction.replace(R.id.fragmentContainer, new FeedFragment());
          transaction.commit();
          getSupportActionBar().setTitle(R.string.title_fragment_feed);
      }
  }
  </code></pre>
  
  <p><strong>Snippet from xml file</strong></p>
  
  <pre><code>    &lt;android.support.constraint.ConstraintLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
          &lt;FrameLayout
              android:id="@+id/fragmentContainer"
              android:layout_width="0dp"
              android:layout_height="0dp"
              app:layout_constraintBottom_toTopOf="@+id/navigation"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent" /&gt;
  
          &lt;android.support.design.widget.BottomNavigationView
              android:id="@+id/navigation"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:itemBackground="@android:color/white"
              app:itemIconTint="@color/colorPrimaryDark"
              app:itemTextColor="@color/colorPrimaryDark"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:menu="@menu/bottom_nav"
              android:elevation="8dp"/&gt;
      &lt;/android.support.constraint.ConstraintLayout&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cdAIim.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cdAIim.png" alt="enter image description here"></a></p>