Exemplo n.º 1
0
 public boolean onKeyDown(int KeyCode, KeyEvent event) {
   if (event.getAction() == KeyEvent.ACTION_DOWN) {
     if (KeyCode == KeyEvent.KEYCODE_BACK) {
       if (!mFlag) {
         Toast.makeText(getApplicationContext(), "한번 더 누르시면 종료됩니다.", Toast.LENGTH_SHORT).show();
         mFlag = true;
         mKillHandler.sendEmptyMessageDelayed(0, 2000);
         return false;
       } else {
         android.os.Process.killProcess(android.os.Process.myPid());
       }
     }
   }
   return super.onKeyDown(KeyCode, event);
 }
Exemplo n.º 2
0
 private void exitApp() {
   MyApplication.getPeersMgr().stop();
   android.os.Process.killProcess(android.os.Process.myPid());
 }