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

app freeze when applying links to large texts with a lot of links #32

Open
ajdevy opened this issue Mar 10, 2016 · 0 comments
Open

app freeze when applying links to large texts with a lot of links #32

ajdevy opened this issue Mar 10, 2016 · 0 comments

Comments

@ajdevy
Copy link

ajdevy commented Mar 10, 2016

The problem occurs when we have a text with about 3000 symbols, all made of "www.gmail.com www.gmail.com www.gmail.com..." about 230 of them, there are 26 000 for loop iterations in SpannableStringInternal.getSpans() :
at android.text.SpannableStringInternal.getSpans(SpannableStringInternal.java:216)
at android.text.SpannableString.getSpans(SpannableString.java:25)
at android.text.SpannableStringInternal.sendSpanAdded(SpannableStringInternal.java:310)
at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:138)
at android.text.SpannableString.setSpan(SpannableString.java:46)
at com.klinker.android.link_builder.LinkBuilder.applyLink(LinkBuilder.java:226)
at com.klinker.android.link_builder.LinkBuilder.addLinkToSpan(LinkBuilder.java:199)
at com.klinker.android.link_builder.LinkBuilder.addLinkToSpan(LinkBuilder.java:174)
at com.klinker.android.link_builder.LinkBuilder.build(LinkBuilder.java:148)

The problems seems that after every setSpan() call there is a sendSpanAdded() call, which triggers the getSpans(), which iterates for every span it has.

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

1 participant