On 12/28/2009 07:09 PM, Olivier Guilyardi wrote:
> 
> on Android 1.5, using the Allocation Tracker I see that every time I call
> TextView.setText() with a StringBuilder as first argument, a String gets
> allocated from the following call stack (first line is last call):
> 
> java.lang.AbstractStringBuilder       toString        
> java.lang.StringBuilder         toString      
> android.text.TextUtils          stringOrSpannedString 
> android.widget.TextView         setText
> 
> I tried specifying the buffer type with setText(strBuilder,
> TextView.BufferType.NORMAL) but it doesn't change anything.
> 
> Is there a way to avoid this allocation ?

Answering to myself, for the records: the String allocation can be avoided by
using the setText(char[] text, int start, int len) variant.

--
  Olivier

-- 
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