title: Make a landscape Layout in a navigation drawer
body: <p>My application has a navigation drawer that is composed by a main fragment container that change with other fragments when i want to change page. If switch to landscape when i'm in another page the application return to the home page(fragment container).And it's the same if i switch from landscape to portrait. How can i solve this problem? I think i have to change something in the main-activity but i really don't know how to do. </p>
  
  <p>My java actually is like this.</p>
  
  <pre><code>    public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
          NavigationView navigationView = null;
          MainFragment fragment = new MainFragment();
          android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
          fragmentTransaction.replace(R.id.fragment_container,fragment);
          fragmentTransaction.commit();
  
          public boolean onNavigationItemSelected(MenuItem item) {
              // Handle navigation view item clicks here.
              int id = item.getItemId();
              if (id == R.id.nav_home) {
                  MainFragment fragment = new MainFragment();
                  android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                  fragmentTransaction.replace(R.id.fragment_container, fragment);
                  fragmentTransaction.commit();
              } else if (id == R.id.nav_breed) {
                  // Handle the camera action
                  BreedFragment fragment = new BreedFragment();
                  android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                  fragmentTransaction.replace(R.id.fragment_container, fragment);
                  fragmentTransaction.commit();
              }
              DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
              drawer.closeDrawer(GravityCompat.START);
              return true;
          }
      }
  </code></pre>