标签:and trace 方法重写 current ble logs thread log back
Android 软件退出系统按键方法重写
1 //针对Andriod软件退出系统按键方法重写 2 3 private long exitTime = 0;//key down time 4 @Override 5 public boolean onKeyDown(int keyCode, KeyEvent event) { 6 switch (keyCode) { 7 case KeyEvent.KEYCODE_BACK: 8 if (System.currentTimeMillis() - exitTime >= 2000) { 9 exitTime = System.currentTimeMillis(); 10 showToast(getString(R.string.quit_on_double_click_)); 11 return true; 12 } else { 13 showToast(getString(R.string.exiting)); 14 try { 15 Thread.sleep(1000); 16 } catch (InterruptedException e) { 17 e.printStackTrace(); 18 } 19 finish(); 20 } 21 break; 22 } 23 return super.onKeyDown(keyCode, event); 24 }
标签:and trace 方法重写 current ble logs thread log back
原文地址:http://www.cnblogs.com/hbtmwangjin/p/7700286.html