in my android application i\'m using Timer schedule.but getting Timer-0 fatal exception as below.how can i remove it.i have also mentioned code below -
01-28 13:
You can use a CountDownTimer
instead of the Timer
:
Timer timer = new CountDownTimer(Long.MAX_VALUE, 1000) {
public void onTick(long millisUntilFinished) {
// the code in the method run
}
public void onFinish() {
}
};
The methods onTick
and onFinish
will be called in the UI thread.
To make the timer start performing its action, run: timer.start()