Ejemplo n.º 1
0
  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));
    }
  }
Ejemplo n.º 2
0
 private String buildTransaction(final String type) {
   return (type == null)
       ? String.valueOf(System.currentTimeMillis())
       : type + System.currentTimeMillis();
 }