What is the return type of TextView.getText() in android?

android, charsequence, textview, xml

Solution

Because it might contain a `Spannable` object. From the doc:

If `setText()` was called with an argument of `BufferType.SPANNABLE` or `BufferType.EDITABLE`, you can cast the return value from this method to `Spannable` or `Editable`, respectively.

Problem

Why does `TextView.getText()` return a `CharSequence` instead of a `String`? (String is the implementation of the CharSequence)

Original source