7
When using the Edittext view, I saw that it returns an Editable data type and not a String. And it has different methods like getEditableText()
.
What is the main difference between String and this other type of data Editable? Could not a Edittext return a simple String?
Explanations Complete are greatly appreciated
According to the documentation, the difference is mutability, that is, the ability to change the data. Strings are immutable, when you concatenate, a new string is created with the old value and the new together, so I understand, this Editable does not need this.
– user28595
I hadn’t really noticed it, just as I commented in the ramaral response. When editing a String, you need to create a new one. That really makes sense. Thank you Articuno!
– Nakamoto