daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void onBackPressed() {
  2.         DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  3.         if (drawer.isDrawerOpen(GravityCompat.START)) {
  4.             drawer.closeDrawer(GravityCompat.START);
  5.         } else {
  6.             super.onBackPressed();
  7.         }
  8.     }
  9.      
  10. public boolean onNavigationItemSelected(MenuItem item) {
  11.     int id = item.getItemId();
  12.  
  13.     Fragment meuFragmento = null;
  14.     boolean fragmentoSelec = false;
  15.  
  16.     if (id == R.id.nav_inicio) {
  17.         meuFragmento = new bemVindoFragmento();
  18.         fragmentoSelec = true;
  19.     } else if (id == R.id.nav_consulta_lista) {
  20.         meuFragmento = new consultarListaCursosFragmento();
  21.         fragmentoSelec = true;
  22.     }
  23.  
  24.     if (fragmentoSelec == true) {
  25.         getSupportFragmentManager().beginTransaction().replace(R.id.content_principal, meuFragmento).commit();
  26.     }
  27.  
  28.     DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  29.     drawer.closeDrawer(GravityCompat.START);
  30.  
  31.     return true;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top