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

StringIndexOutOfBoundsException #4

Closed
jczerski opened this issue Dec 12, 2018 · 2 comments
Closed

StringIndexOutOfBoundsException #4

jczerski opened this issue Dec 12, 2018 · 2 comments

Comments

@jczerski
Copy link

jczerski commented Dec 12, 2018

Thank you for great library!

I found issue when you calculate trimEndIndex in line 153:
int trimEndIndex = lineEndIndex - (ELLIPSIZE.length() + defValue[0].length() + 1);

it sometimes throw an exception:

Fatal Exception: java.lang.StringIndexOutOfBoundsException
at android.text.SpannableStringBuilder.(SpannableStringBuilder.java:61)
at com.libRG.CustomTextView.updateCollapsedText(SourceFile:154)
at com.libRG.CustomTextView.getTrimmedText(SourceFile:142)
at com.libRG.CustomTextView.setText(SourceFile:126)
at com.libRG.CustomTextView.access$300(SourceFile:44)
at com.libRG.CustomTextView$2.onGlobalLayout(SourceFile:368)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:1013)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2692)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1785)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7833)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Best regards,
Jack

@Rajagopalr3
Copy link
Owner

I got your scenario, you have added the lib_setExpandHint text length is greater than the original text. in this scenario expandable text wont work but probably it should not crash. I will fix the crash issue in next version
lib_setExpandHint text is should be less than original text.

thanks a lot for found the issue.

@Rajagopalr3
Copy link
Owner

Rajagopalr3 commented Dec 13, 2018

crashing issue fixed in v1.8

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

No branches or pull requests

2 participants