title: TextView can't draw on Canvas correctly after calling setText() and invalidate()
body: <p>My purpose is to make an <code>Bitmap</code> image which shows user supplied text, and the image can later be saved into cache.</p>
  
  <p>After calling  <code>TextView.setText()</code> and <code>TextView.invalidate()</code>, the <code>TextView</code> is not being updated as I expected. It still draws previous texts on <code>Canvas</code>.</p>
  
  <pre><code>@Override
  public void onClick(View v) {
      // tv is a TextView and et is an EditText.
      tv.setText(et.getText().toString());
      tv.invalidate();
      // if measure() isn't called, getMeasuredWidth() returns previous value.tv.measure(0, 0);
  
      int screenWidth = (int) tv.getMeasuredWidth();
      int screenHeight = (int) tv.getMeasuredHeight();
  
      if (screenHeight * screenWidth != 0) {
          LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                                                      screenWidth, screenHeight);
          Bitmap testB;
  
          testB = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
          Canvas c = new Canvas(testB);
  
          tv.draw(c);
          // tv draws previous String on Canvas c.
  
          iv = (ImageView) findViewById(R.id.image);
          iv.setLayoutParams(layoutParams);
          iv.setBackgroundColor(Color.RED);
          iv.setImageBitmap(testB);
      }
  }
  </code></pre>
  
  <p>The document says </p>
  
  <blockquote>
    <p><code>public void invalidate ()</code></p>
    
    <p>Invalidate the whole view. If the view is visible,
    <code>onDraw(android.graphics.Canvas)</code> will be called at some point in the
    future. This must be called from a UI thread. To call from a non-UI
    thread, call <code>postInvalidate()</code>.</p>
  </blockquote>
  
  <p>Does it mean I should override the <code>onDraw()</code> method?</p>