You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: