Android How to convert string to editable

We all know that we can set Text (String) in the editText field, but if you want to get an editable variable from a string variable, how do you do it?

For Temp, I created an invisible editText field to set to get from which the string turns into editable.

re: for my own link String again = editablevariable.getText (). toString ()

+6
source share
1 answer

As you probably learned, Editable is an interface, so you cannot call new Editable() .
However, Editable is nothing but String with Spannables, so use SpannableStringBuilder :

 Editable editable = new SpannableStringBuilder("Pass a string here"); 

If you want to change the Spannables, not the text itself, you can use the basic SpannableString .

+25
source

All Articles