×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Correctly pause and resume MIDlet?

    How to correctly pause and then resume midlet? Example code and articles are welcome!

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    229

    RE: Correctly pause and resume MIDlet?

    Hi,

    The MIDlet class has two methods which you override in your own class, startApp() and pauseApp(). All you need to do is to have a boolean flag (called paused maybe) which is set to false in startApp() and true in pauseApp(). Then, depending upon what your midlet does, you simply check the flag and don't do it if the midlet is paused. A game midlet for example would stop it's timer and not perform any tick or render calls if it was paused.

    You can also use the pauseApp() and startApp() as handy places to put your save/load code too, using the rms store for example.

    This is the theory in any case, you'll find that some phones don't call these methods when you think they should. The 3410 for example seems to never call pauseApp(), so you have to find something else to trigger you game pause, or save, or whatever. It all ends up being a bit hit and miss really!

    Hope this helps,

    Steve

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    RE: Correctly pause and resume MIDlet?

    Hi Steve,

    If MIDlet.pauseApp() and MIDlet.startApp() does not work for you, you may still have a chance with Canvas.hideNotify() and Canvas.showNotify().

    Csaba

Posting Permissions

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