title: orientation reset activity Android
body: <p>Every time I turn my phone landscape mode, my activity resets.
  How do I stop the activity from resetting?</p>
  
  <p>Here's the code I tried using but it does not work.</p>
  
  <pre><code>    @Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
  
      if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
          setContentView(R.layout.get_msg);
  
      } else {
          setContentView(R.layout.get_msg);
      }
  }
  </code></pre>
  
  <p>manifest file:</p>
  
  <pre><code>android:configChanges="orientation|keyboardHidden|screenSize"
  </code></pre>
  
  <p>Here is the link where I got it from:</p>
  
  <p><a href="https://stackoverflow.com/questions/17945130/prevent-activity-restarting-when-orientation-changes">prevent activity restarting when orientation changes</a></p>