下面是完整的代碼:
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | isCanceled: " + event.isCanceled() + " | info: " + event.toString());
if ((event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) == KeyEvent.FLAG_FROM_SYSTEM)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_FROM_SYSTEM");
}else {}
if ((event.getFlags() & KeyEvent.FLAG_TRACKING) == KeyEvent.FLAG_TRACKING)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_TRACKING");
}else {}
///FLAG_WOKE_HERE
if ((event.getFlags() & KeyEvent.FLAG_WOKE_HERE) == KeyEvent.FLAG_WOKE_HERE)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_WOKE_HERE");
}else {}
//FLAG_SOFT_KEYBOARD
if ((event.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_SOFT_KEYBOARD");
}else {}
//FLAG_KEEP_TOUCH_MODE
if ((event.getFlags() & KeyEvent.FLAG_KEEP_TOUCH_MODE) == KeyEvent.FLAG_KEEP_TOUCH_MODE)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_KEEP_TOUCH_MODE");
}else {}
//FLAG_EDITOR_ACTION
if ((event.getFlags() & KeyEvent.FLAG_EDITOR_ACTION) == KeyEvent.FLAG_EDITOR_ACTION)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_EDITOR_ACTION");
}else {}
//FLAG_CANCELED
if ((event.getFlags() & KeyEvent.FLAG_CANCELED) == KeyEvent.FLAG_CANCELED)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_CANCELED");
}else {}
//FLAG_VIRTUAL_HARD_KEY
if ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY) == KeyEvent.FLAG_VIRTUAL_HARD_KEY)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_VIRTUAL_HARD_KEY");
}else {}
//FLAG_LONG_PRESS
if ((event.getFlags() & KeyEvent.FLAG_LONG_PRESS) == KeyEvent.FLAG_LONG_PRESS)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_LONG_PRESS");
}else {}
//FLAG_CANCELED_LONG_PRESS
if ((event.getFlags() & KeyEvent.FLAG_CANCELED_LONG_PRESS) == KeyEvent.FLAG_CANCELED_LONG_PRESS)
{
Log.i("==BCR==", "onKeyDown - keycode: " + keyCode + " | FLAG: FLAG_CANCELED_LONG_PRESS");
}else {}
修改我的答案。只有當..沒有其他的.. – Ronnie