-
Notifications
You must be signed in to change notification settings - Fork 0
ViewChangeEvents
Since AndroidAnnotations 3.0
This annotation is intended to be used on methods to receive events defined by android.view.View.OnFocusChangeListener.onFocusChange(View view, boolean hasFocus) when the focus state of a view has changed. The annotation value should be one or several R.id.* fields that refers to a subclass of View. If not set, the method name will be used as the R.id.* field name. The method may have multiple parameters:
- A android.view.View parameter to know which view has targeted this event.
- An boolean parameter to know if the view gain or lost the focus.
Some usage examples of @FocusChange annotation:
@FocusChange(R.id.helloTextView)
void focusChangedOnHelloTextView(View hello, boolean hasFocus) {
// Something Here
}
@FocusChange
void helloTextViewFocusChanged(View hello) {
// Something Here
}
@FocusChange({R.id.editText, R.id.helloTextView})
void focusChangedOnSomeTextViews(View hello, boolean hasFocus) {
// Something Here
}
@FocusChange(R.id.helloTextView)
void focusChangedOnHelloTextView() {
// Something Here
}
This annotation is intended to be used on methods to receive events defined by android.widget.CompoundButton.OnCheckedChangeListener.onCheckedChanged(CompoundButton buttonView, boolean isChecked) when the check state of a compound button has changed. The annotation value should be one or several R.id.* fields that refers to a subclass of View. If not set, the method name will be used as the R.id.* field name. The method may have multiple parameters:
- A android.widget.CompoundButton parameter to know which compound button has targeted this event.
- An boolean parameter to know if the view is checked.
Some usage examples of @CheckedChange annotation:
@CheckedChange(R.id.helloCheckBox)
void checkedChangeOnHelloCheckBox(CompoundButton hello, boolean isChecked) {
// Something Here
}
@CheckedChange
void helloCheckBoxCheckedChanged(CompoundButton hello) {
// Something Here
}
@CheckedChange({R.id.aCheckBox, R.id.helloCheckBox})
void checkedChangedOnSomeCheckBoxs(CompoundButton hello, boolean isChecked) {
// Something Here
}
@CheckedChange(R.id.helloCheckBox)
void checkedChangedOnHelloCheckBox() {
// Something Here
}
AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
27/12/2013 The 3.0 release is out !
- Get started!
- Download
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow