|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.midlet.MIDlet
example.stock.StockMIDlet
public class StockMIDlet
The MIDlet application class that we'll run for the Stock Demo.
Field Summary | |
---|---|
(package private) javax.microedition.lcdui.Display |
display
The MIDlet 's display object |
Constructor Summary | |
---|---|
StockMIDlet()
Default constructor that is called by the application manager to create a new instance of this MIDlet after
which the MIDlet enters the Paused state. |
Method Summary | |
---|---|
void |
destroyApp(boolean unconditional)
When the application management software has determined that the MIDlet is no longer needed, or perhaps needs to make room
for a higher priority application in memory, is signals
the MIDlet
that it is a candidate to be destroyed by invoking the
destroyApp(boolean) method. |
void |
pauseApp()
This method is invoked by the application management software when the MIDlet no longer needs to be active. |
void |
startApp()
This method is invoked when the MIDlet
is ready to run and
starts/resumes execution after being in the Paused
state. |
Methods inherited from class javax.microedition.midlet.MIDlet |
---|
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
javax.microedition.lcdui.Display display
MIDlet
's display object
Constructor Detail |
---|
public StockMIDlet() throws javax.microedition.midlet.MIDletStateChangeException
Default constructor that is called by the application
manager to create a new instance of this MIDlet
after
which the MIDlet
enters the Paused
state.
javax.microedition.midlet.MIDletStateChangeException
Method Detail |
---|
public void startApp()
This method is invoked when the MIDlet
is ready to run and
starts/resumes execution after being in the Paused
state. The
MIDlet
acquires any resources it needs,
enters the
Active
state and begins to perform its service,
which in this
case means it displays the main menu on the screen.
The method proceeds like so:
StockDatabase
and the
AlertDatabase
RecordStore
Ticker
on
the top of the screens and instantiate the Ticker object using that
string. That string will be constructed of the names and prices of
the stocks in our databaseMIDlet
's
Display
objectTimerTask
and Timer
and
associate the two setting the refresh interval to the value of
the refresh_interval variable
startApp
in class javax.microedition.midlet.MIDlet
MIDletStateChangeException
- is thrown if the
MIDlet
cannot start now but might be able to
start at a later time.MIDlet
public void pauseApp()
This method is invoked by the application management software when
the MIDlet
no longer needs to be active. It is a stop
signal for the MIDlet
upon which the MIDlet
should release any resources which can be re-acquired through the
startApp
method which will be called upon re-activation of
the
MIDlet
. The MIDlet
enters
the Paused
state upon completion of this method.
pauseApp
in class javax.microedition.midlet.MIDlet
MIDlet
public void destroyApp(boolean unconditional) throws javax.microedition.midlet.MIDletStateChangeException
When the application management software has determined that the
MIDlet
is no longer needed, or perhaps needs to make room
for a higher priority application in memory, is signals
the MIDlet
that it is a candidate to be destroyed by invoking the
destroyApp(boolean)
method. In this case, we need to destroy
the RecordEnumeration
s so that we don't waste their memory
and close the open RecordStore
s. If the
RecordStore
s
are empty, then we do not need them to be stored as
they will be recreated
on the next invokation of the MIDlet
so
we should delete them.
At the end of our clean up, we must call notifyDestroyed
which will inform the application management software that we are done
cleaning up and have finished our execution and can
now be safely terminated and
enters the Destroyed
state.
destroyApp
in class javax.microedition.midlet.MIDlet
unconditional
- If true when this method is called,
the MIDlet
must
cleanup and release all resources. If false the MIDlet
may throw MIDletStateChangeException
to indicate it
does not want to be destroyed at this time.
MIDletStateChangeException
- is thrown if the MIDlet
wishes to continue to
execute (Not enter the Destroyed
state). This
exception is ignored if unconditional
is equal
to true.
javax.microedition.midlet.MIDletStateChangeException
MIDlet
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |