title: Get GridView actual column width in Android
body: <p>Hello fellow developers.</p>
  
  <p>I have a Grid View in an android application. The grid view has the setting to automatically fit the number of columns and has a minimum column width of 250 pixels.</p>
  
  <p>Inside the grid cells, I have a LinearLayout that has an Image View and some Text Views.</p>
  
  <p>I want my Image View to be always square, but unfortunately I was not able to do this with any layout settings (open to suggestions here, if there is an option I missed).</p>
  
  <p>So my idea is that I should somehow get the grid column width in my image Loading class and adjust the imageView height dynamically there, to match the width.</p>
  
  <p>I failed getting the column width though.
  If I set a breakPoint in my  <code>public View getView(int position, View convertView, ViewGroup parent)</code> I see that my parent ViewGroup is the Grid and it has the correct value of the column width, but when I use:</p>
  
  <pre><code>GridView mGridView = (GridView)parent;
  int width = mGridView.getColumnWidth();
  </code></pre>
  
  <p>the app crashes as it says there is no getColumnWidth method.</p>
  
  <p>Any help here?</p>