SpannableStringBuilder: indexOutOfBoundsException setSpan ends beyond length 0

后端 未结 4 2006
夕颜
夕颜 2021-01-11 22:40

I am working in android. i have a problem. my application crashes when i click on my text box second time.

this is my Logcat message:

java.lang.Index         


        
4条回答
  •  遥遥无期
    2021-01-11 23:30

    setSpan (4 ... 4) ends beyond length 0, this means you have a 4 white space character string its actual/trimmed length is zero, setting selection to this will cause IndexOutOfBoundsException, you should check the trimmed length before setting selection

提交回复
热议问题