Alexandre Bianchi Alexandre Bianchi - 1 year ago 110
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

Answer Source

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)) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download