Monday, March 22, 2010

Alarm Timer

// If the user selected date and/or time that is earlier
// than today, set a flag. We are using getTime()
// method of the Date class, which returns the # of
// milliseconds since January 1, 1970

// Create a new timer
tm = new Timer();
tt = new AlarmTimer();

// Amount of time to delay
long amount = dfAlarmTime.getDate().getTime() -
currentTime.getTime();
tm.schedule(tt,amount);
// Remove the commands
fmMain.removeCommand(cmAlarm);
fmMain.removeCommand(cmReset);
// Remove the DateField
fmMain.delete(dateIndex);
// Change the Form message
fmMain.setTitle("Sleeping...");
}
} else if (c == cmReset) {
// Reset to the current date/time
dfAlarmTime.setDate(currentTime = new Date());
} else if (c == cmExit) {
destroyApp(false);
notifyDestroyed();
}
}
// Handle the timer task
private class AlarmTimer extends TimerTask {
public final void run() {
Alert al = new Alert("Time to wake up!");
al.setTimeout(Alert.FOREVER);
al.setType(AlertType.ALARM);
AlertType.ERROR.playSound(display);
display.setCurrent(al);



read more...

No comments:

Post a Comment

Please, select your language:

Recommended Software :: Free Download ::

Click image to download Java Development Kit (JDK)

Click image to download Wireless Toolkit (WTK)

Click image to download Crimson Editor
We have placed this source code in the public domain. You can use, modify, and distribute the source code and executable programs based on the source code. However, note the following:
DISCLAIMER OF WARRANTY
This source code is provided "as is" and without warranties as to performance or merchantability. The author and/or distributors of this source code may have made statements about this source code. Any such statements do not constitute warranties and shall not be relied on by the user in deciding whether to use this source code.
We just wanted to share our knowledge. Indeed some source code uploaded here private property, but some other source code, we get from other sites. Therefore, we do not claim that all the source code is ours. once again, we're just trying to share with others. If you feel that one of your source code created in this blog and feel reluctant to share with others. You can email us at stateid_next2@yahoo.com. thank you.

Keyword : timer, alarm, schedule, src, set timer, set alarm

Timer : Snooze.java

Details Description

Download

SimpleTimer MIDlet

Details Description

Download

DATETODAY

Details Description

Download

PROJECT 01 : SET TIMER SCHEDULE

Details Description

Download Source

Download App Jar and Jad

ALARMMIDLET

Details Description

Download

ALARM TIMER

Details Description

Download

FIXED RATE SCHEDULE MIDLET.JAVA

Details Description

Download