@Retention(value=CLASS)
@Target(value=METHOD)
public @interface TextChange
This annotation is intended to be used on methods to receive events defined
by
TextWatcher.onTextChanged(CharSequence s, int start, int before, int count)
when the text is changed on the targeted TextView or subclass of TextView.
The annotation value should be one or several R.id.* fields that refers to TextView or subclasses of TextView. If not set, the method name will be used as the R.id.* field name.
The method MAY have multiple parameter :
TextView
parameter to know which view has
targeted this eventExamples :@TextChange(R.id.helloTextView) void onTextChangesOnHelloTextView(CharSequence text, TextView hello, int before, int start, int count) { // Something Here } @TextChange void helloTextViewTextChanged(TextView hello) { // Something Here } @TextChange({R.id.editText, R.id.helloTextView}) void onTextChangesOnSomeTextViews(TextView tv, CharSequence text) { // Something Here } @TextChange(R.id.helloTextView) void onTextChangesOnHelloTextView() { // Something Here }
BeforeTextChange
,
AfterTextChange
Copyright © 2010-2014. All Rights Reserved.