Enterprise J2ME Developing Mobile Java Applications [Electronic resources]

Michael Juntao Yuan

نسخه متنی -صفحه : 204/ 192
نمايش فراداده

A.1 Life Cycle Methods

MIDP applications are managed by the Application Management Software (AMS) on devices. The AMS starts, stops, or pauses the MIDP application by calling its main MIDlet class's life cycle methods. The MIDlet can also notify the AMS when its state changes. Any MIDlet class must extend the javax.microedition.midlet.MIDlet class and customize the life cycle methods. The life cycle methods and their descriptions are listed in Table A.1.

Table A.1. MIDlet Life Cycle Methods

Method

Description

startApp()

Called by the AMS when the MIDlet starts to recover from the pause state.

destroyApp()

Called by the AMS when the MIDlet is terminated.

pauseApp()

Called by the AMS when the MIDlet is paused.

notifyDestroyed()

Called by the MIDlet. It asks the AMS to destroy the MIDlet itself.

notifyPaused()

Called by the MIDlet. It asks the AMS to pause the MIDlet itself.

resumeRequest()

Called by the paused MIDlet (e.g., from a background thread). It notifies the AMS that the MIDlet desires to come out of the paused state and become active again.