标签:style blog io color sp div on log as
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (System.currentTimeMillis() - mExitTime > 2000) { Toast.makeText(getApplicationContext(), "再按一次返回键退出", Toast.LENGTH_SHORT).show(); mExitTime = System.currentTimeMillis(); } else { finish(); ExitApplication.getInstance().exit(); } return true; } return super.onKeyDown(keyCode, event); }
2秒内双击返回退出应用
标签:style blog io color sp div on log as
原文地址:http://www.cnblogs.com/weixiong-wang/p/4078301.html