StringIndexOutBounds when text is less than trim length
nilskassube opened this issue · 11 comments
If you try to trim by length, and the length of the text is smaller than the limit, you get
java.lang.StringIndexOutOfBoundsException: length=8; regionStart=0; regionLength=101
at java.lang.String.startEndAndLength(String.java:298)
at java.lang.String.getChars(String.java:598)
at android.text.TextUtils.getChars(TextUtils.java:81)
at android.text.SpannableStringBuilder.(SpannableStringBuilder.java:65)
at com.borjabravo.readmoretextview.ReadMoreTextView.updateCollapsedText(ReadMoreTextView.java:137)
at com.borjabravo.readmoretextview.ReadMoreTextView.getTrimmedText(ReadMoreTextView.java:115)
at com.borjabravo.readmoretextview.ReadMoreTextView.getDisplayableText(ReadMoreTextView.java:92)
at com.borjabravo.readmoretextview.ReadMoreTextView.setText(ReadMoreTextView.java:86)
java.lang.StringIndexOutOfBoundsException: length=9; regionStart=0; regionLength=241
at java.lang.String.startEndAndLength(String.java:298)
at java.lang.String.getChars(String.java:598)
at android.text.TextUtils.getChars(TextUtils.java:81)
at android.text.SpannableStringBuilder.<init>(SpannableStringBuilder.java:65)
at com.borjabravo.readmoretextview.ReadMoreTextView.updateCollapsedText(ReadMoreTextView.java:137)
at com.borjabravo.readmoretextview.ReadMoreTextView.getTrimmedText(ReadMoreTextView.java:115)
at com.borjabravo.readmoretextview.ReadMoreTextView.getDisplayableText(ReadMoreTextView.java:92)
at com.borjabravo.readmoretextview.ReadMoreTextView.setText(ReadMoreTextView.java:86)
at com.borjabravo.readmoretextview.ReadMoreTextView.access$200(ReadMoreTextView.java:36)
at com.borjabravo.readmoretextview.ReadMoreTextView$1.onGlobalLayout(ReadMoreTextView.java:206)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:912)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1969)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Same issue. 👍
Tring to use this textview inside recyclerview. @bravoborja any help or suggestions?
i have same problem
I have same problem,When I use the ReadMoreTextView in RecyclerView,My App will crash,so I abandon it in my App
any body have resolve it ?
Is there any progress on this issue?
i have same problem if any have solution?
@sandeshlasnapure can you show me your for "readmore"?
using handler may be solve the problem
this is a big problem
When I use the ReadMoreTextView in RecyclerView,My App will crash
java.lang.StringIndexOutOfBoundsException: length=3; regionStart=0; regionLength=885
at java.lang.String.startEndAndLength(String.java:298)
at java.lang.String.getChars(String.java:598)
at android.text.TextUtils.getChars(TextUtils.java:85)
at android.text.SpannableStringBuilder.(SpannableStringBuilder.java:65)