Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: CountDownTimer - Even im in next Activity, it's still counting in the previous and onFinish() is executed

Taboo:

It's kinda hard to explain,

FirstActivity - after 15 seconds in Countdowntimer onFinish() takes me to the SecondActivity, sounds simple, BUT even it takes me to the secondActivity, CountDownTimer on the First one is restarting(?) and counting again and again so after next 15 seconds onFinish() is executed, and after 30sec. so on so on.


CountDownTimer cdt = new CountDownTimer(15000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
time.setText("seconds remaining: " + millisUntilFinished / 1000);
}


@Override
public void onFinish() {

cdt.cancel();
Intent next = new Intent(FirstActivity.this, SecondActivity.class);

startActivity(next);
}
}.start();

I've tried .stop/ .cancel/ .destroy nothing works. I hope You guys can help me with this one, thx : )



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: CountDownTimer - Even im in next Activity, it's still counting in the previous and onFinish() is executed

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×