Alexandre Bianchi Alexandre Bianchi - 3 months ago 53
Android Question

Material Drawer opens automatically as activity starts

When I use Material Drawer, as soon as a new activity starts, drawer is being displayed automatically, but I want that it starts hidden, so I have to use function drawer.closeDrawer() in the method onResume of activity, as described below:

protected void onResume() {


Is this the correct way to hidden the drawer when activity starts or restarts, or there is a property to be set for this purpose in the drawer?

Thank you,

Alexandre Bianchi


Put this code in oncreate and it will check the drawer is open or not...if its open it will close the drawer

    DrawerLayout layout = (DrawerLayout) findViewById(;
         if (layout.isDrawerOpen(GravityCompat.START)) {