按鍵監聽 onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {


//監聽F4 搜尋
    if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getAction() == KeyEvent.ACTION_DOWN) {
       
        return true;
    }

//監聽F1 返回
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {

        return true;
    }

    return super.onKeyDown(keyCode, event);
}