@Retention(value=CLASS) @Target(value=METHOD) public @interface KeyUp
This annotation is intended to be used on methods to receive action up event
on a key. This annotation can be used on methods of classes which implements
KeyEvent.Callback.
The annotation value should be one or several of
KeyEvent constant fields which name contains KEYCODE. If
not set, the method name will be used as the KeyEvent
.KEYCODE_* field name.
The method may return a boolean, void, or a
Boolean. If returning void, it will be considered as
returning true (ie: the method has handled the event).
The method MAY have one parameter:
KeyEvent parameter to know which key has been down
Example :
@EActivity
public class MyActivity extends Activity {
@KeyUp
void enter() {
// ...
}
@KeyUp
void onEnter() {
// ...
}
@KeyUp
void onEnterPressed() {
// ...
}
@KeyUp
void enterPressed() {
// ...
}
@KeyUp(KeyEvent.KEYCODE_0)
void keyZeroIsUp(KeyEvent keyEvent) {
// ...
}
@KeyUp({ KeyEvent.KEYCODE_M, KeyEvent.KEYCODE_N })
boolean multipleKeys(KeyEvent keyEvent) {
return false;
}
}
KeyEvent,
KeyEvent.Callback,
KeyEvent.Callback.onKeyUp(int, android.view.KeyEvent)| Modifier and Type | Optional Element and Description |
|---|---|
int[] |
value
The
KeyEvent class constants which name contains
KEYCODE. |
Copyright © 2010–2018 simpligility technologies inc.. All rights reserved.