Event called on pressing menu button in nokia touch device - java-me

I made a J2ME application(2D game) for nokia touch device like C7, N8 etc.
When I press the menu button while the gameplay is on, I reach the home screen on the device, but in the background, the game music still plays.
Can anyone tell me which event is called on pressing the menu button, and any possible solution to this problem?

Call player.stopPlayer() in hideNotify() method of canvas. Probably gameCanvas of your application.
You can restart the music in showNotify() of your gameCanvas.

Canvas.hideNotify() is called when the midlet goes to background see this article as well

Related

Detect Touch event in UIWebView

I want to finish such a demand, in the interface embedded UIWebView control, when the user clicks on a blank area and the area that link, jump to different new interface, but I can't distinguish between the two. Could someone help me?
I try put an transparent NSView over an UIWebView, and overide the touchesDidBegin etc, then send them to your webview. Ex: But the UIWebView can't accept touch events。

Is there a way in j2me, or at least on nokia phones, to light up the screen after screen saver kicks in?

I have a midlet which checks some conditions and at some point, when some condition becomes true, I display a pop-up dialog to the user.
If nothing happens for a while, the screen saver kicks in and after that the pop-up is not shown to the user - the screen is simply dark.
Is there way to wake up from the screen saving mode programmatically?
I know I can alert the user by sound and vibration and I do that, but I'd like to be able
to get the screen to react in some way (either to flash the lights, or just turn the light on).
Is there any way to do that?
You can implement showNotify() and hideNotify() from the Canvas class.

inputAccessoryView not hide the view when -resignFirstResponder?

I have attached a toolbar with a UITextField and UIButton to the keyboard when it becomes the first responder via the user taping inside the textfield
textField.inputAccessoryView = theToolbar;
Problem is, the toolbar disappears when the keyboard is dismissed, thus preventing any further input.
Any ideas on how to make the toolbar go back to the bottom of the screen rather than off it completely?
I'm thinking a delegate method might help but Im really not too sure. It seems once the inputAccessoryView always the inputAccessoryView :(
Cheers
The input accessory view is automatically dismissed with the input view (the keyboard, in this case). Generally you do not want to have an input accessory view in your view hierarchy. Instead, if you want your toolbar to scroll up when the keyboard is shown, you should follow the guidelines for Managing the Keyboard.
You could try using an additional toolbar that is offscreen as the inputAccessoryView, which could "fake" the appearance of what you are trying to do. Alternatively, have you tried adding the toolbar back to the bottom of the screen using
[self.view addSubview:theToolbar];
when the keyboard reaches the bottom of the screen? You can use keyboard notifications for this.

J2ME, LWUIT (V. 1.2) - Menu bar from bottom to the right of the screen!

I'm working with the mobile graphic framework LWUIT (V. 1.2) to develop an application for Nokia N97.
Results are striking and elegant but I have a problem: when I rotate mobile screen, menu bar doesn't switch from bottom to the right of screen. Commands remain on the bottom while correspondent mobile buttons are now on the right...
Is there an event that I can intercept when the user open or rotate mobile screen? Or I have to extend some library class to make this behaviour automatic? Or anithing else?
Anyone of you can describe a solution?
Thanks in advance
I didn't use LWUIT much, but you can insert following parameter to jad:
Nokia-MIDlet-App-Orientation: portrait
This should disable auto-rotating on Nokia S60 5th.
If you want to catch an event when the screen rotates, you can check canvas.getWidth() and canvas.getHeight(). If device's screen is not square, its width and height should change.

Touch event on midlet command

I am creating application for touch devices for nokia.
J2ME provides methods pointerPressed, released and dragged on canvas.
I have generated a canvas in full screen mode having commands.
On click of "option" command, another command menu opens, which is having commands like Ok, Back, Next.
Now to get the event of sub command menu I have to get that which command is clicked.
My question is how can I get that particular command has been clicked?
Application is for N97/Music express (no keyboard support). I just want the way out using touch functionality.
keyPressed event is not at all useful for me.
If you have pointer events, then look at the co-ordinates of the event, and check to see whether it lies within where you're drawing your menu option on the canvas.

Resources