Package icyllis.modernui.text
Interface TextWatcher
- All Superinterfaces:
NoCopySpan
- All Known Implementing Classes:
PasswordTransformationMethod
When an object of this type is attached to an Editable, its methods will
be called when the text is changed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.text.NoCopySpan
NoCopySpan.Concrete
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called to notify you that, somewhere withins
, the text has been changed.void
beforeTextChanged
(CharSequence s, int start, int count, int after) This method is called to notify you that, withins
, thecount
characters beginning atstart
are about to be replaced by new text with lengthafter
.void
onTextChanged
(CharSequence s, int start, int before, int count) This method is called to notify you that, withins
, thecount
characters beginning atstart
have just replaced old text that had lengthbefore
.
-
Method Details
-
beforeTextChanged
This method is called to notify you that, withins
, thecount
characters beginning atstart
are about to be replaced by new text with lengthafter
. It is an error to attempt to make changes tos
from this callback. -
onTextChanged
This method is called to notify you that, withins
, thecount
characters beginning atstart
have just replaced old text that had lengthbefore
. It is an error to attempt to make changes tos
from this callback. -
afterTextChanged
This method is called to notify you that, somewhere withins
, the text has been changed. It is legitimate to make further changes tos
from this callback, but be careful not to get yourself into an infinite loop, because any changes you make will cause this method to be called again recursively. (You are not told where the change took place because other afterTextChanged() methods may already have made other changes and invalidated the offsets. But if you need to know here, you can useSpannable.setSpan(java.lang.Object, int, int, int)
inonTextChanged(java.lang.CharSequence, int, int, int)
to mark your place and then look up from here where the span ended up.
-