×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    35

    Unhappy destroyapp(true) and destroyapp(false)

    Hi everybody,

    I have a silly doubt about destroyapp. According to the specification given by java destroyapp will be called by the AMS to destroy the application. So it means there is no use of calling it by ourselves. then how it is decided that the parameter in it is false or true.




    the specification is given below:

    destroyApp
    protected abstract void destroyApp(boolean unconditional)
    throws MIDletStateChangeException
    Signals the MIDlet to terminate and enter the Destroyed state. In the destroyed state the MIDlet must release all resources and save any persistent state. This method may be called from the Paused or Active states.
    MIDlets should perform any operations required before being terminated, such as releasing resources or saving preferences or state.

    Note: The MIDlet can request that it not enter the Destroyed state by throwing an MIDletStateChangeException. This is only a valid response if the unconditional flag is set to false. If it is true the MIDlet is assumed to be in the Destroyed state regardless of how this method terminates. If it is not an unconditional request, the MIDlet can signify that it wishes to stay in its current state by throwing the MIDletStateChangeException. This request may be honored and the destroy() method called again at a later time.

    If a Runtime exception occurs during destroyApp then they are ignored and the MIDlet is put into the Destroyed state.

    Parameters:
    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.
    Throws:
    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.

  2. #2
    Registered User
    Join Date
    Jun 2009
    Posts
    35

    Re: destroyapp(true) and destroyapp(false)

    and i also want to know some example when AMS will call the destroyapp()
    except the case when user press the exit button.

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: destroyapp(true) and destroyapp(false)

    Quote Originally Posted by Manish_Bansal View Post
    then how it is decided that the parameter in it is false or true.
    It's decided by the device. I'm not sure exactly when shutting down might be optional, and most devices will always pass "true" to destroyApp().

    Quote Originally Posted by Manish_Bansal View Post
    and i also want to know some example when AMS will call the destroyapp() except the case when user press the exit button.
    This is pretty much the only case for most devices. I guess some might call it in a low-memory situation, if some apps need to be shut down, but I've never seen it happen.

    I always assume that destroyApp() will be final.

    Graham.

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    35

    Re: destroyapp(true) and destroyapp(false)

    user press the exit button.
    here the exit button specifies the red button of the mobile or also the exit button written by the programmer on left soft key and right soft key too?

    As per my thinking it should be only the red key pressed on the mobile. so it is gonna call the destroyapp in case of nokia series 40 devices and not in case of S60 devices because in that case the application will be minimized and not closed

    and how about other devices? which dont contain red key like in sony ericsson?

Similar Threads

  1. Difference between destroyApp(false) and destroyApp(true)
    By Basu in forum Mobile Java General
    Replies: 4
    Last Post: 2008-10-24, 16:09
  2. destroyApp(true) doesn't work?
    By Stephie in forum Mobile Java General
    Replies: 2
    Last Post: 2006-10-15, 12:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •