package example.com.materialdesignnavigationdrawer;

import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;

public class MainActivity extends AppCompatActivity {

    private DrawerLayout dl ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        dl = (DrawerLayout) findViewById(R.id.DL);

    }

    @Override
    public void onBackPressed() {
        if (dl.isDrawerOpen(Gravity.RIGHT)){
            dl.closeDrawer(Gravity.RIGHT);
        }else {
            super.onBackPressed();
        }
    }

}
