English | Site Directory

Android - An Open Handset Alliance Project

android.util
public abstract class

android.util.ResettableTimeout

java.lang.Object
android.util.ResettableTimeout

Utility class that you can call on with a timeout, and get called back after a given time, dealing correctly with restarting the timeout.

For example, this class is used by the android.os.Vibrator class.

Summary

Public Constructors

          ResettableTimeout()

Public Methods

        void  cancel()
Cancel the timeout and call off now.
        void  go(long milliseconds)
Does the following steps.
abstract        void  off()
Override this to do what you need to do when it's stopping.
abstract        void  on(boolean alreadyOn)
Override this do what you need to do when it's starting This is called with the monitor on this method held, so be careful.
Methods inherited from class java.lang.Object

Details

Public Constructors

public ResettableTimeout()

Public Methods

public void cancel()

Cancel the timeout and call off now.

public void go(long milliseconds)

Does the following steps.

1. Call on()

2. Start the timer.

3. At the timeout, calls off()

If you call this again, the timeout is reset to the new one

public abstract void off()

Override this to do what you need to do when it's stopping. This is called with the monitor on this method held, so be careful.

public abstract void on(boolean alreadyOn)

Override this do what you need to do when it's starting This is called with the monitor on this method held, so be careful.

Parameters

alreadyOn is true if it's currently running
Build m5-rc15i - 10 Jun 2008 13:54