|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Timer
public class Timer
Application interface to timers. You can use Timer to get notified based on time. Timer uses the event system to send notifications. One can setup a new Timer, activate it, and handle the timer event callback by handling EventType.EVENT_TIMER in the receiveEvent() method. The requirement is that one has to be a listener to be able to receive timer events. Timer's granularity is in milliseconds. Timer does not run when the system is in the sleep mode. For example, when you set up an timer to fire in 1 minute, but the system goes into sleep for a minute right after the timer is activated, the timer won't fire for another minute after the system wakes up from sleep mode. This is because Timer is based on the system clock, which stops running in sleep mode. Another note worth mentioning is that the system time on Danger OS wraps every 49.23 hours. The Timer class is designed to operate correctly when the system time wraps.
| Constructor Summary | |
|---|---|
Timer(int delay)
Class constructor specifying delay time. |
|
Timer(int delay,
boolean repeats,
Listener target)
Class constructor specifying delay time, repeat option, and listener. |
|
Timer(int delay,
boolean repeats,
Listener target,
int data)
Class constructor specifying delay time, repeat option, listener, and data Constructs an timer with the specified delay time. |
|
Timer(int delay,
boolean repeats,
Listener target,
int data,
Object context)
Class constructor specifying delay time, repeat option, listener, event data, and context Constructs an timer with the specified delay time. |
|
Timer(int delay,
boolean repeats,
Listener target,
Object context)
Class constructor specifying delay time, repeat option, listener, and context Constructs an timer with the specified delay time. |
|
| Method Summary | |
|---|---|
void |
resetDelay(int inDelay)
Reset the timer's time. |
void |
start()
Starts the timer. |
void |
stop()
Stops the timer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Timer(int delay)
delay - time to timer firing specified in milliseconds from when the timer is activated.
the minimum delay time allowed is 30 milliseconds.
public Timer(int delay,
boolean repeats,
Listener target)
delay - time to timer firing specified in milliseconds from when the timer is activated.
the minimum delay time allowed is 30 milliseconds.repeats - whether the timer is to be repeated.target - Listener.Listener
public Timer(int delay,
boolean repeats,
Listener target,
int data)
delay - time to timer firing specified in milliseconds from when the timer is activated.
the minimum delay time allowed is 30 milliseconds.repeats - whether the timer is to be repeated.target - Listener.data - data argument to be passed back in the Timer event.Listener
public Timer(int delay,
boolean repeats,
Listener target,
Object context)
delay - time to timer firing specified in milliseconds from when the timer is activated.
the minimum delay time allowed is 30 milliseconds.repeats - whether the timer is to be repeated.target - Listener.context - argument to be passed back in the Timer event.Listener
public Timer(int delay,
boolean repeats,
Listener target,
int data,
Object context)
delay - time to timer firing specified in milliseconds from when the timer is activated.
the minimum delay time allowed is 30 milliseconds.repeats - whether the timer is to be repeated.target - Listener.data - data argument to be passed back in the Timer event.context - argument to be passed back in the Timer event.Listener| Method Detail |
|---|
public void start()
public void stop()
public void resetDelay(int inDelay)
inDelay - time to timer firing specified in milliseconds from now.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||