|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Alarm
public class Alarm
Application interface to alarms. You can use Alarm to get notified based on time. Similar to the Timer class, Alarm uses the event system to send notifications. One can setup a new Alarm, activate it, and handle the alarm event callback by handling EventType.EVENT_ALARM in the receiveEvent() method. The requirement is that one has to be a listener to be able to receive alarm events. Unlike the Timer, Alarm's granularity is in seconds. From the Alarm user's perspective, Alarm also runs when the system is in the sleep mode. For example, when you set up an alarm to fire in 10 minutes, the alarm will fire in 10 minutes, whether or not the system goes into sleep mode in between.
| Constructor Summary | |
|---|---|
Alarm(int wake)
Class constructor specifying wake time. |
|
Alarm(int wake,
Listener target)
Class constructor specifying wake time and listener. |
|
Alarm(int wake,
Listener target,
int data,
Object context)
Class constructor specifying wake time, listener and context. |
|
Alarm(int wake,
Listener target,
Object context)
Class constructor specifying wake time, listener and context. |
|
| Method Summary | |
|---|---|
void |
activate()
Activate the alarm. |
void |
deactivate()
Deactivate the alarm. |
static void |
forceProcessAlarms()
Force the alarm dispatcher to process the alarms. |
static int |
getNextAlarmTime()
Returns the next alarm wake time. |
void |
resetWake(int inWake)
Reset the alarm's wake time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Alarm(int wake)
wake - time to wake specified in seconds from the time the Alarm is activated.
public Alarm(int wake,
Listener target)
wake - time to wake specified in seconds from the time the Alarm is activated.target - Listener.Listener
public Alarm(int wake,
Listener target,
Object context)
wake - time to wake specified in seconds from the time the Alarm is activated.target - Listener.context - argument to be passed back in the Alarm event.Listener
public Alarm(int wake,
Listener target,
int data,
Object context)
wake - time to wake specified in seconds from the time the Alarm is activated.target - Listener.data - optional data to be passed back to the Alarm event.context - argument to be passed back in the Alarm event.Listener| Method Detail |
|---|
public void activate()
public void deactivate()
public void resetWake(int inWake)
inWake - time to wake specified in seconds from now.public static int getNextAlarmTime()
public static void forceProcessAlarms()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||