문제

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

도움이 되었습니까?

해결책

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.

다른 팁

it actually returns Editable and not CharSequence but you can store it in a String variable by calling toString() on it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top