title: How to change layout when rotate?
body: <p>I have an <code>xml</code> in <code>layout-normal</code>, <code>layout-large</code> and <code>layout-land</code>. What I'm trying to do is to use the provided <code>xml</code> in specific <code>orientation</code>. </p>
  
  <p>I already search for it here and this are what I've already tried.</p>
  
  <p>1) I used different <code>layout</code> name but same <code>ids</code> in it and override <code>onConfigurationChanged</code> and set the <code>layout</code> there. Here's my code</p>
  
  <pre><code>@Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
  
      if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
      {
          setContentView(R.layout.activity_login2);
      }
      if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
      {
          setContentView(R.layout.activity_login );
      }
  }
  </code></pre>
  
  <p>It does changed but when the screen rotates the inputed data in the <code>EditText</code> is gone. I tried to use <code>onSaveInstanceState</code> to save the <code>instance</code> but still the same. It looks like it destroys the activity and create a new one where all my widget that is initialized in <code>onCreate</code> is gone.  </p>
  
  <p>2) Then I found <code>layout-land</code> and just put the landscape layout there with same layout name like in <code>layout-normal</code> and <code>layout-large</code> example is </p>
  
  <p><code>res/layout-land -&gt; activity_login.xml</code></p>
  
  <p><code>res/layout-normal-&gt; activity_login.xml</code></p>
  
  <p><code>res/layout-large-&gt; activity_login.xml</code></p>
  
  <p>and removes the <code>onConfigurationChanged</code> on the code but still doesn't work. </p>
  
  <p>In my <code>AndroidManifest</code> in <code>LoginActivity</code> I put </p>
  
  <pre><code>     &lt;activity
          android:name=".LoginActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"
          android:theme="@style/DefaultTheme"
          android:windowSoftInputMode="adjustResize"&gt;
          &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt; 
  </code></pre>
  
  <p>Is there anyway to change the layout when screen is rotated? Thank you in advance. </p>