Fatal Exception: String can't be cast to Spannable

前端 未结 3 1521
太阳男子
太阳男子 2021-01-12 02:06

My app works greatly with the exception of a few devices. On one such device, I get a FATAL EXCEPTION in one of my activities. The error is java.lang.ClassCastExcept

相关标签:
3条回答
  • 2021-01-12 02:38

    Did you make your style button as spannable? For example, TextView should be like this

    TextView.setText("Hai", TextView.BufferType.SPANNABLE);

    0 讨论(0)
  • 2021-01-12 02:41

    it seems like i was calling android:imeOptions="actionDone" in the xml layout file. i removed that and it didn't crash anymore.

    why?

    0 讨论(0)
  • 2021-01-12 02:49

    This may be a little bit late but, make sure the text in the TextView you are trying to Span isn't set as "". For some reason empty strings are not spannable.

    0 讨论(0)
提交回复
热议问题