title: Android GridVIew Change number of columns depending on Orientation
body: <p>I want to display 6 images in the form of grid as follows.</p>
  
  <p>in portrait orientation,2 coumns, 3 rows and
  in landscare orientation 3 columns, 2 rows</p>
  
  <p>By using Android GridView and by defining different grid layouts in layout-port and layout-land directories I was able to achieve this effect.</p>
  
  <p>Later as per my activity requirement, I added one parameter in manifest.xml that is </p>
  
  <pre><code>android:configChanges = "mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize"`
  </code></pre>
  
  <p>to stop my activity to recreate once screen orientation changes.</p>
  
  <p>After adding this parameter, my grid view is not behaving in expected way. It sometimes shows 1 column, sometimes 2 columns, and sometimes 3 columns.</p>
  
  <p>I am placing <code>gridView.setNumberOfColumns(2)</code> or <code>gridView.setNumberOfColumns(3)</code> methods in the get view method of my grid adapter depending on orientation of the device.</p>
  
  <p>Please help me to achieve this effect without removing the <code>android:configChanges</code> parameter in Manifest.xml</p>