这个是aide软件里的双击退出的代码,和之前发的iapp双击退出是一个样子的!
代码
static boolean isExit; // 点击两次退出变量 public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (!isExit) { isExit = true; Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(3000); isExit = false; } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } else { finish(); } return false; } else { return super.onKeyDown(keyCode, event); }