Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.    /**
  2.      * Timer using Recursive
  3.      *
  4.      * @param view
  5.      */
  6.     private void startCountUsingRecursive(final View view) {
  7.         this.keepCount = true;
  8.         this.recursive(view);
  9.     }
  10.  
  11.     /**
  12.      * recursive funtion for Recursive's timer,
  13.      * stop once the keepCount == false,
  14.      * otherwise, keep recursive
  15.      *
  16.      * @param view
  17.      */
  18.     private void recursive(final View view) {
  19.         view.postDelayed(new Runnable() {
  20.             @Override
  21.             public void run() {
  22.                 if (keepCount) {
  23.                     second++;
  24.                     update();
  25.                     recursive(view);
  26.                 }
  27.             }
  28.         }, 1000L);
  29.     }
  30.  
  31.     /**
  32.      * refresh timer's textfield
  33.      */
  34.     private void update() {
  35.         final TextView textView = (TextView) this.findViewById(R.id.textView_counter);
  36.         textView.setText(this.reformat(this.second));
  37.     }