glo*_*glo 5 java android cocos2d-x android-activity
我正在使用cocos2dx制作一个小游戏,在我的游戏活动中,我给出了以下功能来处理后退按钮.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return super.onKeyDown(keyCode, event);
}
@Override
public void onDestroy()
{
android.os.Process.killProcess(android.os.Process.myPid());
super.onDestroy();
}
Run Code Online (Sandbox Code Playgroud)
在按下后退按钮时,我在logcat中收到以下警告
无法打开keycharmap文件
加载keycharmap文件'/system/usr/keychars/qtouch-touchscreen.kcm.bin'时出错.hw.keyboards.65538.devname = '的QTouch-触摸屏'
该调用未达到onKeyDown或onDestroy函数.
请告诉我为什么会出现此警告以及为什么我无法处理android后退按钮.
这些函数在我的java android项目中正常工作,但在我的cocos2d-x项目中没有
它已在文件中处理 Cocos2dxGLSurfaceView.java
把它改成下面,myActivitycocos2dActicity在哪里
case KeyEvent.KEYCODE_BACK:
AlertDialog ad = new AlertDialog.Builder(myActivity)
.setTitle("EXIT?")
.setMessage("Do you really want to exit?")
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
((Cocos2dxActivity)myActivity).finish();
}
})
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
}).create();
ad.show();
return true;
case KeyEvent.KEYCODE_MENU:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3674 次 |
| 最近记录: |