android4.0+怎么捕获home键 不用event方法QQQQQQQQ求77777777777777777777
http://blog.sina.com.cn/s/blog_896b1e670100wqcy.html
http://f120412352.iteye.com/blog/1461501
http://blog.sina.com.cn/s/blog_896b1e670100wqcy.html
4.0以上home键不可监听
private class HomeBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "HomeBroadcastReceiver";
String SYSTEM_REASON = "reason";
String SYSTEM_HOME_KEY = "homekey";
public void onReceive(Context text, Intent intent) {
Log.i(TAG, "onReceive...");
String action = intent.getAction();
if (action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
String reason = intent.getStringExtra(SYSTEM_REASON);
if (SYSTEM_HOME_KEY.equals(reason)) {
finish();
}
}
}
}
# 广播的形式
通过广播来监听Home按键消息。对应的Action是Intent.ACTION_CLOSE_SYSTEM_DIALOGS
详见
http://blog.csdn.net/robertcpp/article/details/51501570