> Rather wasteful on a platform like Android. Are there any other
> options other than Formatter?

I think it does exactly what you want

>> >         final Formatter f = new Formatter();

use Formatter(Appendable a)

 StringBuilder sb = new StringBuilder();

 final Formatter f = new Formatter(sb);

         for (Sentinel s : Sentinel.mSentinels) {
          if (s.mIsLive) {
                  pos++;
                f.format("%4d%5d", s.mPos.x, s.mPos.y);
             canvas.drawText(sb.toString(), x_pos, (pos *
mHalfHeight), mPaint);
              }
  sb.setLength(0);

see StringBuilder

toString

public String toString()

    Returns a string representing the data in this sequence. A new
String object is allocated and initialized to contain the character
sequence currently represented by this object. This String is then
returned. Subsequent changes to this sequence do not affect the
contents of the String.

I assume a String is less costly than a Formatter.

Shawn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to