给楼主朋友提供另一种解决方式
就是使用
public void onPause(){
super.onPause();
};
这个事件处理
就是使用
public void onPause(){
super.onPause();
};
这个事件处理
解决方案 »
- Android开发实现显示Pdf文件
- 怎样修改程序的权限?
- 为什么activity和service不能new啊?
- 大家帮我看看这个异常是怎么造成,该如何解决啊?谢谢啦
- HTC Desire Z AudioRecord issue: AudioHardwareMSM7X30 cannot open /dev/msm_pcm_in
- Android现在支持perl了吗?
- 求教关于eclipse中avd的sd卡内容显示问题,求大神帮忙
- webview加载的网页,js调用问题,高手来指点一下
- Android中有没有办法通过jni在Linux内核获取摄像头yuv数据??
- 高德地图怎么接入软件里边
- android udp真是垃圾啊还是我写得垃圾。
- handlerthread中的线程问题
Frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManger.java
的interceptKeyBeforeDispatching方法。
它有如下代码: if (mHomePressed) {
// If we have released the home key, and didn't do anything else
// while it was pressed, then it is time to go home!
if (keyCode == KeyEvent.KEYCODE_HOME) {
if (!down) {
mHomePressed = false;
if (!canceled) {
// If an incoming call is ringing, HOME is totally disabled.
// (The user is already on the InCallScreen at this point,
// and his ONLY options are to answer or reject the call.)
boolean incomingRinging = false;
try {
ITelephony telephonyService = getTelephonyService();
if (telephonyService != null) {
incomingRinging = telephonyService.isRinging();
}
} catch (RemoteException ex) {
Log.w(TAG, "RemoteException from getPhoneInterface()", ex);
}
if (incomingRinging) {
Log.i(TAG, "Ignoring HOME; there's a ringing incoming call.");
} else {
launchHomeFromHotKey();
}
} else {
Log.i(TAG, "Ignoring HOME; event canceled.");
}
}
}
但是现在我在android虚拟机上的确是可以在上层app捕获到home键的,但是在我自己的手机却不行
我的手机的系统是自己刷上去的, 作者改了什么源码,我是不知道的。。
继续求指导!
ocreate()中的setContentView()后面添加
Window win = getWindow(); WindowManager.LayoutParams lp = win.getAttributes();
lp.flags |= 0x80000000;
win.setAttributes(lp);
在onkeydown()事件中添加
if(event.getKeyCode() == KeyEvent.KEYCODE_HOME){
return true;
}