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

Crash on too many rounds #85

Open
Pluckerpluck opened this issue Oct 29, 2014 · 1 comment
Open

Crash on too many rounds #85

Pluckerpluck opened this issue Oct 29, 2014 · 1 comment

Comments

@Pluckerpluck
Copy link

I still get a crash when I have enough rounds such that the numbers would drop off the bottom of the list (probably require scrolling).

I have reported the error, it gives a ClassCastException in widget.AutofitTextView.onMeasure;

It states that SpannableString cannot be cast to SpannedString.

My guess is this occurs on line 65:

ForegroundColorSpan[] foregroundColorSpans = ((SpannedString) getText()).getSpans(startOfLastLine + 1, cutoffIndex, ForegroundColorSpan.class);

as this is the only place a cast of this type occurs.

This could be fixed by instead casting to the interface (Spanned). This interface is also the interface for SpannedString anyway, so it should make no difference if this is NOT the problem. This is, however, the preferred way of dealing with casting variables in Java. Whenever possible, one should cast to the interface rather than the implementation (unless you need it). This is why you regularly see things like the following:

List myList = new ArrayList();

rather than

ArrayList myList = new ArrayList();

The Android Javadocs also state that getText() can be cast to either Spannable or Editiable (not SpannedString) depending on how it was set.


All in all, even if this isn't a bug I believe it should be changed. Though I do believe it is the bug I am experiencing.

@BuonOmo
Copy link

BuonOmo commented Mar 21, 2017

I have the same issue now. Sadly, this makes the application unusable...

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