title: Programmatically getting the width of a TextView
body: <p>I'm attempting to build a layout programmatically.</p>
  
  <p>This layout is dynamic. Based on the data read from a database, it could look different every time.</p>
  
  <p>I have a LinearLayout with its orientation set to vertical.</p>
  
  <p>I want to fit as many TextViews with text (the data from database) as I can on a "row".</p>
  
  <p>What I'm doing is building LinearLayouts that are the rows.  These LinearLayouts are populated with TextViews.  I build the TextView, set the text, and then check the width to see if it will fit on this row (by subtracting the sum of all TextView widths from the screen width and see if the new TextView will fit).  If not, I create a new LinearLayout and start adding TextViews to that one.</p>
  
  <p>The problem is myTextView.getWidth() and myTextView.getMeasuredWidth() both return 0.</p>
  
  <p>Why?  How can I get the width of the TextView?</p>