/**
* Timer using Recursive
*
* @param view
*/
private void startCountUsingRecursive(final View view) {
this.keepCount = true;
this.recursive(view);
}
/**
* recursive funtion for Recursive's timer,
* stop once the keepCount == false,
* otherwise, keep recursive
*
* @param view
*/
private void recursive(final View view) {
view.postDelayed(new Runnable() {
@Override
public void run() {
if (keepCount) {
second++;
update();
recursive(view);
}
}
}, 1000L);
}
/**
* refresh timer's textfield
*/
private void update() {
final TextView textView = (TextView) this.findViewById(R.id.textView_counter);
textView.setText(this.reformat(this.second));
}