title: setContentview() change layout in onConfigurationChanged() but not set the Data in android
body: <p>I have created two layouts for portrait and landscape mode, My scenario is I want to change the Text of TextView based on the orientation changes. here is my code:-</p>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>&lt;activity android:name=".MainActivity"
          android:configChanges="orientation|screenSize|keyboardHidden"&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>activity_main.xml (portrait)</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.demo.textdemo.MainActivity"&gt;
  &lt;TextView
      android:id="@+id/textViewHello"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="Hello World!"
      android:layout_gravity="center"
      android:gravity="center"
      android:textSize="20dp" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>activity_main.xml (landscape):</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.demo.textdemo.MainActivity"&gt;
  
  &lt;TextView
      android:id="@+id/textViewHello"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:text="Hello World!"
      android:layout_gravity="center"
      android:gravity="center"
      android:textSize="20dp"
      /&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  TextView textViewHello;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      textViewHello = (TextView)findViewById(R.id.textViewHello);
      Configuration newConfig = getResources().getConfiguration();
      if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
          textViewHello.setText("ORIENTATION LANDSCAPE");
      }else {
  
          textViewHello.setText("ORIENTATION PORTRAIT");
      }
  
  }
  
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
      if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
          Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
          setContentView(R.layout.activity_main);
  
          textViewHello.setText("ORIENTATION LANDSCAPE");
  
      } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
          Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
          setContentView(R.layout.activity_main);
          textViewHello.setText("ORIENTATION PORTRAIT");
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>For the First Time, it shows the change in TextView according to the Orientation but when I change the Orientation it shows "Hello World!" , which define in activity_main.xml, I don't know why ?? </p>