Reputation: 825
I have activity where I am running a CountDownTimer,if a calls comes or I rotate the screen the timers is still working continuously in some phone but in others phone the timers is not working,and I haven't done anything to retain the state.
So I want to know is there any special feature to these phone to retain the activity state?
here is the code :
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("done!");
}
}.start();
Upvotes: 1
Views: 55
Reputation: 6201
In android is a method that return the last information.
> if (getLastNonConfigurationInstance() != null) {
> CountDownTimer/something }
@Override
public Object onRetainNonConfigurationInstance() {
return CountDownTimer/something;
}
Upvotes: 1