点击返回键,触发onKeyDown事件:
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { checkExit(); return true; } return super.onKeyDown(keyCode, event); }
转载于:https://blog.51cto.com/7728665/1561227