private void pressAgainToExit() { long current = System.currentTimeMillis(); long duration = (current - lastPressBackTime) / 1000; if (duration <= PRESS_AGAIN_LIMIT_DURATION) { runOnUiThread( new Runnable() { @Override public void run() { try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } // exitApp(); finish(); } }); } else { lastPressBackTime = current; ToastUtil.showToast(getApplicationContext(), getString(R.string.press_again_to_exit)); } }
private String buildTransaction(final String type) { return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis(); }