Code example for SpannableString

Methods: length, setSpan

0
    }*/ 
 
    public static CharSequence contactToToken(Recipient c) {
    	String name       = c.getName();
    	String number     = c.getNumber();
        SpannableString s = new SpannableString(RecipientsFormatter.formatNameAndNumber(name, number));
        int len           = s.length();
 
        if (len == 0) {
            return s;
        } 
 
        s.setSpan(new Annotation("number", c.getNumber()), 0, len,
                Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 
        return s;
    } 
 
    public void populate(Recipients list) {
        SpannableStringBuilder sb = new SpannableStringBuilder();