title: change navigation drawer when call fragment from another fragment
body: <p>I have created a navigation drawer using fragments. I have a function that changes fragments when clicked on drawerlist item. I have Some created some fragments. I want to call another fragment inside current fragment on a button click. but when I click on Button It actually changes fragment but I want navigation to be changed as well when fragment is called. Please suggest me something.</p>
  
  <p>I have two fragments named HomeFragment and FindPeopleFragment. and a button in HomeFragment fragment that calls FindPeopleFragment</p>
  
  <p>Here is my button click event written in HomeFragment</p>
  
  <pre><code>View rootView = inflater.inflate(R.layout.fragment_home, container, false);
  
      Button btn = (Button) rootView.findViewById(R.id.find_people);
      btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Fragment fragment = new FindPeopleFragment();
              if (fragment != null) {
                  FragmentManager fragmentManager = getFragmentManager();
                  fragmentManager.beginTransaction()
                          .replace(R.id.frame_container, fragment).commit();
              }
          }
      });
  </code></pre>
  
  <p>Here is code that changes fragments in MainActivity</p>
  
  <pre><code>Fragment fragment = null;
      switch (position) {
      case 0:
          fragment = new HomeFragment();
          break;
      case 1:
          fragment = new FindPeopleFragment();
          break;
      case 2:
          fragment = new PhotosFragment();
          break;
      case 3:
          fragment = new CommunityFragment();
          break;
  
      default:
          break;
      }
  
      if (fragment != null) {
          FragmentManager fragmentManager = getFragmentManager();
          fragmentManager.beginTransaction()
                  .replace(R.id.frame_container, fragment).commit();
  
          // update selected item and title, then close the drawer
          mDrawerList.setItemChecked(position, true);
          mDrawerList.setSelection(position);
          setTitle(navMenuTitles[position]);
          mDrawerLayout.closeDrawer(mDrawerList);
      } else {
          // error in creating fragment
          Log.e("MainActivity", "Error in creating fragment");
      }
  </code></pre>
  
  <p>Here is code written in onCreate of MainActivity</p>
  
  <pre><code>mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
  
      // setting the nav drawer list adapter
      adapter = new NavDrawerListAdapter(getApplicationContext(),
              navDrawerItems);
      mDrawerList.setAdapter(adapter);
  </code></pre>
  
  <p>Here is link of code  in which I am doing same thing <a href="https://github.com/rohit-iiita/SlidingMenu/" rel="nofollow">link</a></p>