Jump to content
  • Advertisement
Sign in to follow this  
GekkoCube

J2ME, handling the red END key.

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

During any point in a MIDlet's life-time, is there any way to properly handle the red key (END key) so that the application/game does not terminate? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Normally, no. A few phones will allow you to ignore the red END button by passing in "true" to the "unconditional" parameter of destroyApp. If it does this, you can throw a MIDletStateChangeException to refuse to terminate. Most phones, however, don't give you the choice.

Share this post


Link to post
Share on other sites
Nokia Series 60 phones do not kill your app when you hit the END key, but instead put them into the background. But they apparently don't send pauseApp() either, because of Nokia's broken implementation :) But you *will* receive showNotify() and hideNotify() as appropriate.

And wouldn't that be a *false* 'unconditional' value which allows you to escape? (Note that this is being passed in by the phone, not from your code.)

And you can throw the exception anyway, the compiler can't do anything to stop you. The phone will presumably ignore it and quit anyway, though.

This is one of the many things I find silly about the whole MIDlet class design: I can't imagine why you'd *ever* check the 'unconditional' parameter, given that the caller is responsible for handling any exception anyway. Hell, they even made MSCE *checked*!

(Or does the preverifier maybe do something weird here? o_O)

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
And wouldn't that be a *false* 'unconditional' value which allows you to escape? (Note that this is being passed in by the phone, not from your code.)
Er, yeah. *smacks self*

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!