【梅开二度】aide双击退出代码。
代码
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);
}http://cdn.u1.huluxia.com/g4/M02/01/17/rBAAdl81DFyAB9eGAAASQHnJck0391.jpg
为毛老子总也抢不到沙发?!!
页:
[1]