Say, if I want the CountDownTimer to update some UI elements when it has finished, but there is a configuration change in the middle of the countdown, forcing the activity to be recreated.
public class MyActivity extends Activity {
private TextView textView;
....
public void onButtonClicked(View view)
{
// start CountDownTimer
new CountDownTimer(10000, 10000) {
public void onTick(long millisUntilFinished) {
// do nothing
}
public void onFinish() {
textView.setText("Hello World!");
}
}.start();
}
}
I find that when the CountDownTimer finishes, it set the textView in the activity just got destroyed, but not the recreated one