I know that I can change color of the part of TextView with Spannable, I use this for changing color of every character 'e' in text. But I got this error:
java.lang.IndexOutOfBoundsException: setSpan (55 ... 56) ends beyond length 0
My code:
aye="My Text has been written today";
SpannableString spantext=new SpannableString(aye);
for (int i=0;i<aye.length();i++) {
    if (aye.contains("e")) {
        a+=aye.indexOf("e", a)+1;
        spantext.setSpan(new ForegroundColorSpan(Color.RED), a, a+1, 0);
        holder.tv_arabic.setText(spantext);
    }
}
Any way?
 
     
     
     
    