title: NullPointerException at TextView.checkForRelayout() while setText()
body: <p>I am trying to implement ViewHolder pattern to improve perfomance while drawing on canvas over the map.
  I need to create some labels for my markers. This method is called  while data processing in <code>draw()</code></p>
  
  <pre><code>// now we create label view and convert it into bitmap
  private Bitmap createLabelBitmap(GisLaborHistoryObject object, HistoryPoint point) {
      // create view from xml
      if (vh == null) {
          vh = new ViewHolder();
          vh.view = inflater.inflate(R.layout.map_gis_history_label, null, false);
          vh.tv = (TextView) vh.view.findViewById(R.id.gislabeltext);
      }
  
      // set label content
      if (vh.tv != null) {
          if (!mSingleLaborHistory) {
              String name = "";
              name = object.getDisplayName();
              if (name == null || "".equals(name))
                  name = object.getPersonId();
              if (name == null || "".equals(name))
                  name = object.getLaborCode();
              if (name == null)
                  name = "";
  
              vh.tv.setText(name);
          } else
              vh.tv.setText(point.getChangeDate());
      } 
      // measure resulting view
      vh.view.measure(spec, spec);
      vh.view.layout(0, 0, vh.view.getMeasuredWidth(), vh.view.getMeasuredHeight());
      Bitmap b = Bitmap.createBitmap(vh.view.getWidth(), vh.view.getHeight(), Bitmap.Config.ARGB_8888);
      canvasToDraw.setBitmap(b);
      canvasToDraw.translate(-vh.view.getScrollX(), -vh.view.getScrollY());
      vh.view.draw(canvasToDraw);
      return b;
  }
  </code></pre>
  
  <p>spec is</p>
  
  <pre><code>spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
  </code></pre>
  
  <p>the result is
  Logcat:</p>
  
  <pre><code> 04-29 17:12:34.057: E/AndroidRuntime(389): java.lang.NullPointerException
   04-29 17:12:34.057: E/AndroidRuntime(389):     at android.widget.TextView.checkForRelayout(TextView.java:5497)
   04-29 17:12:34.057: E/AndroidRuntime(389):     at android.widget.TextView.setText(TextView.java:2730)
   04-29 17:12:34.057: E/AndroidRuntime(389):     at android.widget.TextView.setText(TextView.java:2598)
   04-29 17:12:34.057: E/AndroidRuntime(389):     at android.widget.TextView.setText(TextView.java:2573)
   04-29 17:12:34.057: E/AndroidRuntime(389):     at com.xxx.android.proj.ui.map.overlays.LaborsMarkerOverlay.createLabelBitmap(LaborsMarkerOverlay.java:164)
  </code></pre>
  
  <p>XML layout i use</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/gislabeltext"
  style="@style/labelStyle"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:paddingLeft="2dp"
  android:paddingRight="2dp" /&gt;
  </code></pre>
  
  <p>what can be a reason of this error?</p>