@Retention(value=CLASS)
@Target(value=METHOD)
public @interface EditorAction
This annotation is intended to be used on methods to receive events defined
by
TextView.OnEditorActionListener.onEditorAction(android.widget.TextView, int, android.view.KeyEvent)
when an action is performed on the editor.
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 eventKeyEvent
parameterThe return type of the method can be either void or boolean. In case of boolean, the value returned from the annotated method will be returned in the generated listener method (indicating event consumption). If the annotated method is void, always true will be returned in the listener method (so the event is consumed).
Examples :@EditorAction(R.id.helloTextView) void onEditorActionsOnHelloTextView(TextView hello, int actionId, KeyEvent keyEvent) { // Something Here } @EditorAction void helloTextViewEditorAction(TextView hello) { // Something Here } @EditorAction({R.id.editText, R.id.helloTextView}) void onEditorActionsOnSomeTextViews(TextView tv, int actionId) { // Something Here } @EditorAction(R.id.helloTextView) void onEditorActionsOnHelloTextView() { // Something Here } @EditorAction(R.id.helloTextView) boolean onEditorActionsOnHelloTextView() { // Something Here return false; }
Copyright © 2010-2014. All Rights Reserved.