监听不到android 的 Home 键
应用程序监听不了android 机的HOME KEY事件。
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if(keyCode==3)//HOME键码为3
{
HomeKeyNum+=1;
Log.i("gogler", "home key pressed time is: "+HomeKeyNum);
}
return super.onKeyDown(keyCode, event);
}
实验结果没有预期日志输出,把键码换成BACK键码4则可以监听到。
官方解释:
Key code constant: Home key. This key is handled by the framework and is never delivered to applications.
摘自 gogler的专栏
补充:移动开发 , Android ,