title: Android Fragment Inflate layout
body: <p>Hi I'm working with a view pager and fragments. I would like to override orientation changes so that the onCreateView method isn't run everytime the orientation changes. This is because a lot is run in onCreateView for my app which causes the orientation to be slow to change. Also things on my server are checked and what not too so there really is no reason for all of it to run just because the orientation changed. </p>
  
  <p>Here is what i've set up so far</p>
  
  <p>I have this on the MainActivity in the manifest</p>
  
  <pre><code> android:configChanges="orientation|keyboardHidden"
  </code></pre>
  
  <p>And then i am using this in my fragment</p>
  
  <pre><code>@Override
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
      getLayoutInflater(getArguments()).inflate(R.layout.main, null, false);
      Toast.makeText(getActivity(), "changed orientation", Toast.LENGTH_LONG).show();
  }
  </code></pre>
  
  <p>When i run the app and switch orientation i see the toast show but the layout never changes to the landscape one. So I decided that maybe android just wasn't recognizing that it was in landscape since i overrided it but changing the layout to something ridiculous like a layout for a dialog doesn't cause a force close or anything it stays the portrait layout which is stretched as a result so i know there is something wrong with how i'm inflating the layout.</p>
  
  <p>Any help on changing the layout when orientation is changed in a viewpager would be greatly appreciated.</p>
  
  <p>Thank you!</p>