Is it possible to run a timer in background and inform main thread (say a fragment) when it completes? In below code does onTick and onFinish run on main thread? If not then will AyncTask be helpful to inform to main thread upon completion of timer?
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("done!");
}
}.start();