title: Avoiding object allocations in onDraw() (StaticLayout)?
body: <p>I have a custom view which I quickly learned to not do object allocations in and moved all my Paint allocations into a different method, fine. </p>
  
  <p>I need to use a StaticLayout however for some text that had some spannable 'stuff' applied. </p>
  
  <pre><code>    layoutBpm = new StaticLayout(bpmValue,
              textPaintBPM, arcRadius, Layout.Alignment.ALIGN_NORMAL, 0, 1,
              false);
  
      layoutBpm.draw(canvas);
  </code></pre>
  
  <p>This seemed to make sense to me to have in onDraw but I am of course getting warned to avoid this.  It is important to me that I do everything I can to avoid any performance issues so I am trying to do this properly. </p>
  
  <p>I can't seem to find any documentation I can understand that explains what some of the parameters to StaticLayout actually do (float spacingmult? float spacingadd?), but the third one there I think is maximum width for the StaticLayout text which I can only get from onMeasure as it relates to my canvas size.  This leaves me wanting to put the assignment in onMeasure or onDraw, neither of which it seems I am meant to do.  Is it okay to put StaticLayout assignment in onDraw or is there a better way to do this?  </p>
  
  <p>Hope this makes sense, I am very new to this.  Thank you for any help. </p>
  
  <p>(edit: I assume putting this assignment in a method and calling from onDraw/onMeasure is just being silly and will stop Eclipse warning me but wont actually help?)</p>