title: onMeasure from View yielding 0 in my Activity
body: <p>The application runs. What it is supposed to do is display "=Heightofthescreen=" in a textbox where <code>Heightofthescreen</code> is the actual value of the screen. Instead, however, it just gives me a 0. I imagine it is something with my context but I don't know how to fix it.</p>
  
  <p>Activity class:</p>
  
  <pre><code>package com.example.measuringtesting;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class StartDraw extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          Drawing.context2 = getApplicationContext();
          Drawing y = new Drawing(Drawing.context2);
          int theheight = y.width2;
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_start_draw);
          TextView t = new TextView(this); 
  
          t=(TextView)findViewById(R.id.textView1); 
          t.setText("=" + theheight + "=");
      }
  }
  </code></pre>
  
  <p>here is the view class:</p>
  
  <pre><code>package com.example.measuringtesting;
  
  import android.content.Context;
  import android.view.View;
  
  public class Drawing extends View {
  public Drawing(Context context) {
      super(context);
  }
  
  public float width;
  public float height;
  public int width2;
  public int height2;
  public static Context context2;
  
  @Override 
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
  float parentWidth = MeasureSpec.getSize(widthMeasureSpec);
  float parentHeight = MeasureSpec.getSize(heightMeasureSpec);
  this.width = (float) (parentWidth*.15);
  this.height = (float) (parentHeight*.15);
  this.width2 = Math.round(width);
  this.height2 = Math.round(height);
  this.setMeasuredDimension(width2, height2);
  }
  
  }
  </code></pre>