开发者

Trying to set up a countdown timer in Android through multiple Activites

I'm trying to create a app for airports, that the top line will always display a countdown timer to when the plane leaves. This is the code I had.

This class is declared in each activity class. /countdowntimer is an abstract class, so extend it and fill in methods:

public class MyCount extends CountDownTimer{

    public MyCount(long millisIn开发者_StackOverflow中文版Future, long countDownInterval) {
        super(millisInFuture, countDownInterval);
    }

    @Override
    public void onFinish() {
        tv.setText(”done!”);
    }

    @Override
    public void onTick(long millisUntilFinished) {
        tv.setText(”Left: ” + millisUntilFinished/1000);
    }
}

But I wanted it to run on all the activities. I was thinking about having the notification manger to start a thread every 10 seconds, but I cannot access the UI memory on its thread.

Does anybody have a good solution to how to do this?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜