Wow, I updated those string drawing methods to use a reusable
StringBuffer and it seems to have worked!  I'm so happy to have
finally solved this.

Here's the code I used:

private StringBuffer scoreText = new StringBuffer(13); // it will
never be longer than 13 chars.

private void drawInfoHead(Canvas canvas) {
  StringBuffer scoreText = this.scoreText;
  scoreText.delete(0, scoreText.length());
  scoreText.append(score).append(POINTS_TEXT);
  // the paint is right-aligned.
  canvas.drawText(scoreText, 0, scoreText.length(), world.width, 20,
gameResources.scoreInfoTextPaint);
}


On May 25, 4:20 pm, Robert Green <[email protected]> wrote:
> It's a surface view so the whole scene must be rendered every frame.
> I could put it on the background I suppose but it's simple enough to
> just redraw the text.
>
> On May 25, 4:10 pm, Mark Murphy <[email protected]> wrote:
>
> > Robert Green wrote:
> > > I said StringBuffer but I meant "Implied" StringBuffer, you know:
>
> > > canvas.drawText(score + POINTS_LABEL, x, y, paint);
>
> > Why redraw POINTS_LABEL every time? Can't you rework your scoreboard to
> > only draw that once?
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android App Developer Training:http://commonsware.com/training.html
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to