Closed remon closed 8 years ago
when adding emoji and text on the same time I found this error
java.lang.IndexOutOfBoundsException: setSpan (9 ... 10) ends beyond length 9
and the problem is in setspan method
if (!isEmoticonMatcher) { ImageSpan[] oldSpans = getText().getSpans(start, end, ImageSpan.class); if(oldSpans != null){ for (int i = 0; i < oldSpans.length; i++) { int startOld = end; int endOld = after + getText().getSpanEnd(oldSpans[i]) - 1; if (startOld >= 0 && endOld > startOld) { ImageSpan imageSpan = new ImageSpan(oldSpans[i].getDrawable(), ImageSpan.ALIGN_BASELINE); getText().removeSpan(oldSpans[i]); getText().setSpan(imageSpan, startOld, endOld, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); } } } }
when adding emoji and text on the same time I found this error
and the problem is in setspan method