title: Android: How to get size dimensions of a viewgroup?
body: <p>I have a gridlayout who's size I want to check before displaying anything in the activity, because I want to check if an image needs to be resized. Can't do it OnStart() because apparently it hasn't been loaded yet. Adding a listener doesn't work due to synchronization issues with the rest of the code. It would be nice if I could just manually generate the value, by using the dimensions of the device, but I for the life of me can't find the exact value of those stupid margins Android places automatically. Any suggestions? Essentially in the code below I need to have height/width of the GridLayout BEFORE SplitImage() is called. </p>
  
  <p>XML
      </p>
  
  <pre><code>&lt;GridLayout
      android:id="@+id/grid_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:useDefaultMargins="false" &gt;
  
  &lt;/GridLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Relevant JAVA</p>
  
  <pre><code>public class GamePlay extends Activity {
  int difficulty = 0;
  int image = 0;
  int widthView = 0;
  int heightView = 0;
  int boardW;
  int boardH;
  int nSqr;
  Bitmap[][] gameBoard;
  
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                              WindowManager.LayoutParams.FLAG_FULLSCREEN);
      Intent intent = getIntent();
      difficulty = intent.getIntExtra("DIFFICULTY_KEY_DMIROU246", 0);
      image = intent.getIntExtra("LEVEL_KEY_DMIROU246", 0);
      setContentView(R.layout.activity_game_play);
      Log.w("Derp", "1");
  
  }
  
  @Override
  protected void onStart() {
      super.onStart();
      View view = (View) findViewById(R.id.grid_layout);
      Log.w("Derp", "2");
      heightView = view.getHeight();
      widthView = view.getWidth();
      Log.w("Derp", "3");
      gameBoard = SplitImage();
      Log.w("Derp", "9");
  }
  </code></pre>