Spannable is a subclass (or rather, sub-interface) of CharSequence. That means there can be objects out there that implement the latter, but not the former. See the Android javadocs for CharSequence to see which other such classes -besides String- exist. You'll need to do an instanceof check before casting.
posted 7 years ago
chetan dhumane wrote:
Matthew Brown wrote:Does String implement Spannable?
Then you won't be able to cast from a String (which is what you've created) to a Spannable. You'll have to look for a way to create a Spannable object from a String. I suspect that there'll be a class that implements Spannable that takes a String as a constructor argument.
To do a great right, do a little wrong - shakepeare. twisted little ad: