0

什么是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);
        }
    }

谁能帮我完成这个方法做某事然后回去?谢谢你。

4

1 回答 1

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);       
}
于 2013-11-29T15:36:25.527 回答