Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge some spannable objects?

I divide a spannable object into 3 parts, do different operations, and then I need to merge them.

Spannable str = editText.getText(); Spannable selectionSpannable = new SpannableStringBuilder(str, selectionStart, selectionEnd); Spannable endOfModifiedSpannable = new SpannableStringBuilder(str, selectionEnd, editText.getText().length()); Spannable beginningOfModifiedSpannable = new SpannableStringBuilder(str, 0, selectionStart);             

How can I do it? I haven't found the required method or constructor to do it.

like image 364
Eugene Avatar asked Jan 05 '11 15:01

Eugene


1 Answers

You could use this:

TextUtils.concat(span1, span2); 

http://developer.android.com/reference/android/text/TextUtils.html#concat(java.lang.CharSequence...)

like image 187
xil3 Avatar answered Sep 20 '22 17:09

xil3