title: How to back to mainactivity when I click on backbutton?
body: <pre><code>Override
  public void onBackPressed(){
    if(drawer.isDrawerOpen(GravityCompat.START)){
        drawer.closeDrawer(GravityCompat.START);
    }else {
        super.onBackPressed();
    }
  }
  </code></pre>
  
  <p>I have a nav drawer with some items and fragments. When I click on an Item, obviously open a fragment, but how to when any fragment is open backbutton backs to mainactivity layout?</p>