@Retention(value=CLASS) @Target(value=METHOD) public @interface KeyMultiple
This annotation is intended to be used on methods to receive action multiple
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 or two parameter:
KeyEvent parameter to know which key has been down
int or Integer paramter to know the key is how
many times repeatedExample :
@EActivity
public class MyActivity extends Activity {
@KeyMultiple
void enter() {
// ...
}
@KeyMultiple
void onEnter() {
// ...
}
@KeyMultiple
void onEnterPressed() {
// ...
}
@KeyMultiple
void enterPressed() {
// ...
}
@KeyMultiple(KeyEvent.KEYCODE_0)
void keyZeroMultiple(KeyEvent keyEvent) {
// ...
}
@KeyMultiple({ KeyEvent.KEYCODE_M, KeyEvent.KEYCODE_N })
boolean multipleKeys(KeyEvent keyEvent) {
return false;
}
}
KeyEvent,
KeyEvent.Callback,
KeyEvent.Callback.onKeyMultiple(int, int, android.view.KeyEvent)| Modifier and Type | Optional Element and Description |
|---|---|
int[] |
value
The
KeyEvent class constants which name contains
KEYCODE. |
Copyright © 2010–2016 simpligility technologies inc.. All rights reserved.