Close Navigation Drawer on back pressed
<p>I have a material designed navigation drawer created following <a href="http://www.androidhive.info/2015/04/android-getting-started-with-material-design/" rel="noreferrer">this tutorial</a>.</p>

<p>When back button is pressed, the app quit. What I want to do is to close the navigation drawer on back pressed. This is the original code:</p>

<pre><code>drawerFragment = (FragmentDrawer)
                getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
        drawerFragment.setUp(R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
        drawerFragment.setDrawerListener(this);
</code></pre>

<p>I added this:</p>

<pre><code>public void onBackPressed() {
        if (this.drawerFragment.isDrawerOpen(GravityCompat.START)) {
            this.drawerFragment.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }
</code></pre>

<p>However, I got error cannot resolve method <code>isDrawerOpen</code> and <code>closeDrawer</code>.</p>

<p>How can I get it to work?</p>