title: Android - activity with viewpager and fragments does not resume the portrait layout when rotating the device. Only on Huawei smartphones
body: <h2>Introduction</h2>
  
  <p>I'am facing a strange problem that is happening only on the new device I am trying: <strong>Huawei P8</strong>.</p>
  
  <p>I can't put a screenshot of what is happening but I will try to summarize as follow:</p>
  
  <ul>
  <li>The activity has only one layout in folder "layout"</li>
  <li>Some of the fragments that compose the viewpager have both "layout" and "layout-land" layouts for different views depending on the rotation of the device.</li>
  </ul>
  
  <h2>Problem</h2>
  
  <ul>
  <li><p>Starting the activity in portrait everything works and the fragments have their portrait layout</p></li>
  <li><p>Rotating to landscape makes the fragments switch to their landscape layout (if the fragment has its custom landscape layout draws it) correctly</p></li>
  <li><p>When rotating back to portrait the problem appears. The fragments that have a specific landscape layout does not switch back to portrait layout keeping the landscape one and the result is:</p>
  
  <p><strong>With the device in portrait the layout is drawn with landscape layout (took from layout-land)</strong> which is very bad to see because every view is compressed/stretched unnaturally.</p></li>
  </ul>
  
  <p>I have tried many smartphones in the years and <strong>this only happens on Huawei P8 (Android 5.0)</strong></p>