Getting notified when a command menu is shown

I have written a game that has menu via GameCanvas.addCommand(…). When the user presses a button the menu pops up, all handled somewhere in the J2ME framework. Now I would like to pause the game while the popup menu is visible. Is there a way to do that? How do I get notified / poll to see if the pop up is shown?

You could use the hideNotify() method.

shmoove

It aint working.

Neither hideNotify/showNotify nor isShown().

I am running directly on a Sony Ericsson K700. Is this a bug? The popup obscuring the GameCanvas is “system screen”, right? The method isShown() should go to false and hideNotify() should be called, right?

some devices don’t behave correctly - I don’t specifically know about the k700, but from my experience, a lot of phones ignore hideNotify() and other related midlet state methods

Any - aeeeuhhh - alternative methods?

The K700 implements the Nokia UI classes as far as I know, so maybe using the keyPressed() method to capture FullCanvas.KEY_SOFTKEYx presses could do the trick.

shmoove

Here’s another idea:
Instead of adding all the options as Commands to the Canvas, only add one Command called called “Menu”, and when this Command fires open the menu in a List or something (or even better - implement a graphical menu on the Canvas itself). This way you know exactly when the menu is displayed (since it fires a commandAction()).

shmoove

if possible, you might also want to use an ingame rendered menu ?