com.googlecode.androidannotations.annotations
Annotation Type TextChange
@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 :
- A
TextView
parameter to know which view has
targeted this event
- An java.lang.CharSequence parameter to get the modified text.
- An int parameter named start to get the start position of the modified
text.
- An int parameter named before to know the text length before
modification.
- An int parameter named count to know the number of modified characters.
Some usage examples of @BeforeTextChange annotation:
@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
}
value
public abstract int[] value
- Default:
- -1
resName
public abstract String[] resName
- Default:
- ""
Copyright © 2010-2013. All Rights Reserved.