20.1. Timer Support

MIDlets may need to delay or schedule activities to be performed at a later time. The MIDP Specification provides two mechanisms to enable this:

  • Timers are used for time-based events while a MIDlet is running. For example, a timer used to change the frame being shown in an animation sequence. Timers are covered in this section.

  • Alarms provide a one-shot time for MIDlets to be launched if they are not already running. Automatic launching can be convenient, for example, to register the next appointment in a calendar. Alarm-based MIDlet launching is covered in Section 17.1, “Alarm-Based MIDlet Launch.”

The MIDP Specification

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.