Android App Development for Beginners A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.
As you probably found out, Editable is an interface so you cannot call new Editable()
.
However an Editable is nothing more than a String with Spannables, so use SpannableStringBuilder:
Editable editable = new SpannableStringBuilder("Pass a string here");
If you only want to change the Spannables, never the text itself, you can use a basic SpannableString.
Use Editable.Factory.getInstance().newEditable(str)
From the android documentation:
Returns a new SpannedStringBuilder from the specified CharSequence. You can override this to provide a different kind of Spanned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With