Reputation: 14022
Android Docs in about TextView.getText()
say:
Note: The content of the return value should not be modified. If you want a modifiable one, you should make your own copy first.
Also TextView
has setText (CharSequence text, TextView.BufferType type)
method and you can pass TextView.BufferType.EDITABLE
to it to enable casting result of getText()
method to an Editable
. As Docs say the purpose of Editable
interface is:
This is the interface for text whose content and markup can be changed [...]
My question is: If we can pass Editable
to the TextView
and get it, why we should not modify it?
Upvotes: 2
Views: 40