I have implemented a countdown timer in an application of mine. It runs in the background fine and dandy, but when i use advanced task killer, it stops the timer and the only way to restart it is to open the application again. Is there anyway to have the timer persist, even if I use something like advanced task killer?
Code:
TextView tv;
final MyCounter timer = new MyCounter(10000,1000);
tv = (TextView)findViewById(R.id.healthtext);
tv.setText("10");
timer.start();
}
public class MyCounter extends CountDownTimer{
public MyCounter(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
Toast.makeText(getApplicationContext(), "death", Toast.LENGTH_LONG).show();
}
@Override
public void onTick(long millisUntilFinished) {
tv.setText((millisUntilFinished/1000)+"");
as far as I know - nope, since task killers destroy your app's process causing any running threads to exit
Not while the timer is part of your application. You can of course make a timer that is not part of the application.