Are there any limitations to adding an ImageSpan to a widget? This identical code works fine in a standard TextView.
SpannableStringBuilder buf = new SpannableStringBuilder("");
if(!TextUtils.isEmpty(message.getMessageBody())) {
SmileyParser parser = SmileyParser.getInstance();
buf.append(parser.addSmileySpans(group ? message.getMessageBodyWithoutName() : message.getMessageBody()));
}
view.setTextViewText(R.id.message_body, buf);
Thanks.
Edit 1:
public CharSequence addSmileySpans(CharSequence text) {
SpannableStringBuilder builder = new SpannableStringBuilder(text);
Matcher matcher = mPattern.matcher(text);
while (matcher.find()) {
int resId = mSmileyToRes.get(matcher.group());
builder.setSpan(new ImageSpan(mContext, resId),
matcher.start(), matcher.end(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return builder;
}
Uri
? And what are your symptoms? – Cards