title: button not change on back button press in BottomNavigationView
body: <p>i use three fragment in dashbordActivity on bottom navigation bar. On back button press previous fragment view properly but bottom navigation button not changing.</p>
  <p>in first image home fragment is already selected after i select profile from bottom navigation and press backbutton. fragment changes but bottom navigation item does not change.
  <a href="https://i.stack.imgur.com/H2dud.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H2dud.jpg" alt="enter image description here" /></a></p>
  <p>this is my bottom navigation view .....</p>
  <pre><code>  private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
          = new BottomNavigationView.OnNavigationItemSelectedListener() {
      @Override
      public boolean onNavigationItemSelected(@NonNull MenuItem item) {
  
          switch (item.getItemId()) {
              case R.id.navigation_home:
                  setTitle(&quot;Home&quot;);
                  fragment = new FirstFragment();
                  loadFragment(fragment);
                  return true;
              case R.id.navigation_favorite:
  
                  setTitle(&quot;favourite&quot;);
                  fragment = new MyFavoriteAdsFragment();
                  loadFragment(fragment);
                  return true;
              case R.id.navigation_profile:
  
                  setTitle(&quot;Profile&quot;);
                  fragment = new ProfileFragment();
                  loadFragment(fragment);
                  return true;
              case R.id.navigation_myads:
                  setTitle(&quot;Chat&quot;);
                  fragment = new MyAdsFragment();
                  loadFragment(fragment);
                  return true;
              case R.id.navigation_chat:
                  //   mTextMessage.setText(R.string.title_chat);
                  setTitle(&quot;Chat&quot;);
                  fragment = new TabFragmentChatUserList();
                  loadFragment(fragment);
                /* Intent i=new Intent(getApplicationContext(),Chat.class);
                 startActivity(i);*/
                  return true;
          }
          return false;
      }
  };
  
  
    private void loadFragment(Fragment fragment) {
      // load fragment
       transaction = getSupportFragmentManager().beginTransaction();
      transaction.replace(R.id.frame_container, fragment);
      transaction.addToBackStack(&quot;TAG&quot;);
      transaction.commit();
    /*  fragmentManager.beginTransaction().replace(R.id.home_container, frag).addToBackStack(null).commit();*/
  }
  </code></pre>
  <p>ob back press i tryed...</p>
  <pre><code>   @Override
    public void onBackPressed()
    {
  
   // if your using fragment then you can do this way
          int fragments 
    =getSupportFragmentManager().getBackStackEntryCount();
          if (fragments == 1) {
              new AlertDialog.Builder(this)
                      .setMessage(&quot;Are you sure you want to exit?&quot;)
                      .setCancelable(false)
                      .setPositiveButton(&quot;Yes&quot;, new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int id) {
                              finish();
                          }
                      })
                      .setNegativeButton(&quot;No&quot;, null)
                      .show();
  
  
          } else {
              if (getFragmentManager().getBackStackEntryCount() &gt; 1) {
                  getFragmentManager().popBackStack();
                  if(navigation.getSelectedItemId () != R.id.navigation_favorite)
                  {
                      navigation.setSelectedItemId(R.id.navigation_favorite);
                  }
                  else if(navigation.getSelectedItemId () != R.id.navigation_chat)
                  {
                      navigation.setSelectedItemId(R.id.navigation_chat);
                  }
                  else if(navigation.getSelectedItemId () != R.id.navigation_profile)
                  {
                      navigation.setSelectedItemId(R.id.navigation_profile);
                  }
                  else
                  {
                      super.onBackPressed();
                  }
  
              } else {
                  super.onBackPressed();
              }
          }
  </code></pre>