Added MainActivity.onBackPressed

This commit is contained in:
PeratX 2017-04-22 19:46:32 +08:00
parent acf735a050
commit cdfc6c2f06

View File

@ -99,6 +99,16 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
updateUserInterface(getIntent());
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
protected void onDestroy() {
super.onDestroy();