Getting width of View make an exception 'Attempt to read from field on a null object reference'
<p>I'm trying to getting a width value of TextView by </p>

<pre><code>TextView textViewA = new TextView(Context);

textViewA.Text = "Test";
textViewA.Measure(LayoutParams.MatchParent, LayoutParams.WrapContent);
int width = textViewA.MeasuredWidth;
textViewA.Text = width.ToString();
</code></pre>

<p>The error <strong>'Attempt to read from field 'int android.view.ViewGroup$LayoutParams.width' on a null object reference</strong>' is occurred at <code>textViewA.Text = width.ToString();</code></p>

<p>Addtionally, I encounter this error when I use Measure.
How can I resolve it?</p>