My new method doesn't have problems with concatenating but no solution so far has gotten around converting an integer into a String or CharSequence. Any time you put an integer where a String should be, java automatically uses Integer.toString(i) to build a String out of it which allocates a char[] and also makes a new String.
So, besides ripping out stringSize and getChars from integer and holding my own char[] for the converted int, is there a clean way to handle that without new allocations? On May 25, 4:29 pm, Jason Proctor <[email protected]> wrote: > i think Mark is saying that you could redraw the score separately > from the label, potentially saving an implicit new StringBuffer > (stuff).toString () ? > > if score is a number, then it will need to make a new String anyway. > but you could cache the string of the score until the score changes, > so that drawing the score becomes drawing to strings as opposed to > going through StringBuffer. > > hth > > > > >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 > > -- > jason.software.particle --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

