title: How do I change column count of a GridLayout dynamically in Android Studio?
body: <p>I want to set the number of column of a GridLayout by the width of the window.</p>
  
  <p>But, these sort of codes don't work in onCreate() function.</p>
  
  <pre><code>GridLayout gLayout = (GridLayout)findViewById(R.id.a_grid_layout);
  gLayout.setColumnCount(4);
  </code></pre>