title: Null pointer exception when calling measure on inflated layout
body: <p>So I have a layout that is a separate file, so I inflate it. Then I change my text views and image in  my layout, and call measure, but I get a null pointer when I try to measure the layout. I cannot for the life of me figure out why this is. I'm trying to convert the layout to a bitmap eventually. </p>
  
  <pre><code>View inflatedView  = ((Activity)getContext()).getLayoutInflater().inflate(R.layout.my_layout, null);
  
  inflatedView.measure(getWidth(), getHeight());
  inflatedView.layout(0, 0, inflatedView.getMeasuredWidth(),inflatedView.getMeasuredHeight());
  Bitmap viewAsImage = Bitmap.createBitmap(inflatedView.getWidth(), inflatedView.getHeight(), Bitmap.Config.ARGB_8888);
  Canvas viewCanvas = new Canvas(viewAsImage);
  </code></pre>
  
  <p>Here is the XML</p>
  
  <pre><code>&lt;RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:layout_gravity="bottom"
      android:id="@+id/my_layout"
      android:background="@color/transparent_black"&gt;
      &lt;ImageView android:id="@+id/image_left"
          android:layout_width="48dip" android:layout_height="48dip"
          android:layout_centerVertical="true" android:layout_alignParentLeft="true"
          android:scaleType="fitXY" android:maxWidth="48dip" android:maxHeight="48dip"
          android:padding="5dip" /&gt;
      &lt;ImageView android:id="@+id/image_right"
          android:layout_width="wrap_content" android:layout_height="wrap_content"
          android:layout_marginRight="20dip" android:src="@drawable/arrow"
          android:layout_centerVertical="true" android:scaleType="fitXY"
          android:maxWidth="48dip" android:maxHeight="48dip"
          android:layout_alignParentRight="true" /&gt;
      &lt;TextView android:paddingLeft="4dip" android:paddingRight="1dip"
          android:layout_width="wrap_content"         android:layout_height="wrap_content"
          android:layout_toRightOf="@id/image_left"
          android:layout_toLeftOf="@id/image_right"       android:id="@+id/some_name"
          android:maxLines="1" android:ellipsize="end" android:textSize="20sp"
          android:textColor="@color/white"
                      android:layout_centerVertical="true"
          android:textStyle="normal" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>At the measure() line, it throws a null pointer, and I have verified that getWidth and getHeight are giving legitimate values. </p>
  
  <p>Any ideas? </p>
  
  <p>Thanks!</p>