无法打开keycharmap文件

时间:2013-08-27 14:52:33

标签: android menu

keycharmap文件是什么? 当我按下Android设备的背面按钮时,它不会返回,我收到此警告:

08-27 15:46:33.953: W/KeyCharacterMap(19073): Can't open keycharmap file
08-27 15:46:33.953: W/KeyCharacterMap(19073): Error loading keycharmap file
08-27 15:46:33.953: W/KeyCharacterMap(19073): Using default keymap

当我添加此方法时出现此问题:

    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
         //do something
            return true;
        } else {
            return super.onKeyUp(keyCode, event);
        }
    }

任何人都可以帮我完成这个方法做某事并回去吗?谢谢。

1 个答案:

答案 0 :(得分:0)

您应该将代码更改为:

public boolean onKeyUp(int keyCode, KeyEvent event) 
{
        if (keyCode == KeyEvent.KEYCODE_BACK) 
        {
            //do something                
        } 

        //this line must be run for handle back key!  
        return super.onKeyUp(keyCode, event);       
}