You may want to look at CountDownTime also. It seems to work fine
(even when the Screen goes off).
I  took the following from the web:

    public class MyCount extends CountDownTimer {
        public MyCount(long millisInFuture, long countDownInterval) {
          super(millisInFuture, countDownInterval);
        }

        public void onFinish() {
          counter = new MyCount(5000, 1000);
          counter.start ();
        }

        public void onTick(long millisUntilFinished) {
            tv.setText("Hal:" + timer.getTime());
        }
    }


The timer component uses a "Live" Jt component (separate thread):

    private void timer() {

        JtFactory main = new JtFactory ();


        // Create the component

        timer = (Timer) main.createObject (Timer.JtCLASS_NAME);

        // Asynchronous processing of messages.
        main.setSynchronous(false);
        main.sendMessage (timer, new JtMessage (Timer.UPDATE_TIME));


    }


        .....
        counter = new MyCount(5000, 1000);
        counter.start();
        setContentView(tv);
        .......

On Nov 20, 3:58 pm, Paul Townsend <deer...@gmail.com> wrote:
> I made a simple countdown timer and it works as expected when plugged
> in via usb for debugging but when I take it off debugging and the
> screen goes off either time out or power button the handler fails to
> fire at the end time. I have created a custom timer class that gets
> created from the main activity when needed, because its able to have
> multiple countdowns running at the same time. Am I right in thinking
> that the handler just gets paused when the screen goes off and if so
> what are my alternatives. The activity is still in the foreground and
> I assumed the handler would still fire if the screen goes off.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to