本文整理汇总了Java中android.view.KeyEvent.KEYCODE_STAR属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_STAR属性的具体用法?Java KeyEvent.KEYCODE_STAR怎么用?Java KeyEvent.KEYCODE_STAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_STAR属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendDtmf
/**
* Send a dtmf signal to a call
*
* @param callId the call to send the signal
* @param keyCode the keyCode to send (android style)
* @return
*/
public int sendDtmf(int callId, int keyCode) throws SameThreadException {
if (!created) {
return -1;
}
String keyPressed = "";
// Since some device (xoom...) are apparently buggy with key character
// map loading...
// we have to do crappy thing here
if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) {
keyPressed = Integer.toString(keyCode - KeyEvent.KEYCODE_0);
} else if (keyCode == KeyEvent.KEYCODE_POUND) {
keyPressed = "#";
} else if (keyCode == KeyEvent.KEYCODE_STAR) {
keyPressed = "*";
} else {
// Fallback... should never be there if using visible dialpad, but
// possible using keyboard
KeyCharacterMap km = KeyCharacterMap.load(KeyCharacterMap.NUMERIC);
keyPressed = Integer.toString(km.getNumber(keyCode));
}
return sendDtmf(callId, keyPressed);
}
示例2: dispatchKeyEvent
/**
* 屏蔽按键 然而并没什么用。。。
* @param keyEvent 按键事件
* @return 是否已经处理过按键
*/
@Override
public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case KeyEvent.KEYCODE_POWER:
case KeyEvent.KEYCODE_HOME:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_SYM:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_STAR:
return true;
}
return super.dispatchKeyEvent(keyEvent);
}