Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutBounds when text is less than trim length #10

Closed
nilskassube opened this issue Jun 18, 2016 · 11 comments
Closed

StringIndexOutBounds when text is less than trim length #10

nilskassube opened this issue Jun 18, 2016 · 11 comments
Labels
Milestone

Comments

@nilskassube
Copy link

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)

@JigneshWorld
Copy link

JigneshWorld commented Aug 22, 2016

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?

@sandeshlasnapure
Copy link

Still having issue with recycler view, sometime clickable span not adding to text view.
device-2017-01-24-022331

@asywalulfikri
Copy link

i have same problem

@pudao2010
Copy link

I have same problem,When I use the ReadMoreTextView in RecyclerView,My App will crash,so I abandon it in my App

@asywalulfikri
Copy link

any body have resolve it ?

@ziem
Copy link

ziem commented Jun 13, 2017

Is there any progress on this issue?

@Robbypatel1357
Copy link

i have same problem if any have solution?

@Robbypatel1357
Copy link

@sandeshlasnapure can you show me your for "readmore"?

@Robbypatel1357
Copy link

using handler may be solve the problem

@jianjiankedizai
Copy link

this is a big problem

@sondevelopervn
Copy link

sondevelopervn commented Dec 25, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants