title: Disabling navigation drawer from fragment
body: <p>I have an app with a navigation drawer and 4 navigation items (Fragments). In one of the Fragments, I have a tab layout set up with a view pager (3 more Fragments).</p>
  
  <p>From one of these inner fragments, I want to disable/enable the navigation drawer dynamically. Basically, on a button press, I want to restrict access to the navigation drawer (and the re-enable on pressing it again).</p>
  
  <p>How would I do it?</p>
  
  <p>I tried accessing the <code>DrawerLayout</code> of the parent activity from this inner fragment. But I see no methods to enable/disable the navigation drawer.</p>
  
  <p>The way I've added the drawer to my main Activity:</p>
  
  <pre><code>Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  
  DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
  drawer.setDrawerListener(toggle);
  
  NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
  navigationView.setNavigationItemSelectedListener(this);
  </code></pre>
  
  <p>(and of course I've added <code>toggle.syncState()</code> from within the <code>onPostCreate</code> method.</p>