I am developing a mobile application using J2ME and LWUIT. Whenever the default exit Button
(red in color) is pressed on a phone with symbian OS , I want my application to be minimized and not exited. How do i achieve this?
minimizing a mobile application on exit button press
According to Nokia documentation at http://library.developer.nokia.com/index.jsp?topic=/Java_Developers_Library/GUID-C5D3E0F5-72B9-4EE7-8BA7-20DE4A538FB8.html you can add the following jad key: Nokia-MIDlet-No-Exit.
"Prevents the MIDlet from closing via pressing the End key. Instead of closing the MIDlet it is put to the background. The MIDlet can be still closed from the list of open applications."
Example:
Nokia-MIDlet-No-Exit: true
this stuff aint working for me. I tried setting the jad and jar attributes to true/false. However the application still closes on 'end key press' .. any more inputs? –
Martellato
It must be set to true. How did you add it to Jad? Manually? –
Atmometer
Hey, i added it in netbeans..to the manifest file and set the attribute to false. But thats not working. ..anything else to try?> –
Martellato
You must set it to true and it must be on jad file. –
Atmometer
"It must be on jad?" Din get you... All my stuff is loaded into "Application.jar" file. –
Martellato
Maybe you already know this, but I'll say it anyway: J2ME Apps should have a Jad file. Sure, some phones will install using only Jar, but some settings must be placed into a Jad. You can take a look at developers.sun.com/mobility/learn/midp/lifecycle –
Atmometer
Thanks for the article. It was a good read. However , even after adding the entry to my JAD file..my app still exits on 'end key' press. This is what my jad looks like right now: MIDlet-1: ABC, , ABC MIDlet-Jar-Size: 941754 MIDlet-Jar-URL: ABC.jar MIDlet-Name: ABC! MIDlet-Vendor: Vendor MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0 Nokia-MIDlet-No-Exit: true Any idea what could be going wrong? –
Martellato
Your Jad file seems fine. Maybe your handset does not support this key? According to Nokia documentation the Nokia-MIDlet-No-Exit key is supported since Symbian edition S60 3rd Edition FP 2. What is your handset version? –
Atmometer
@ Telmo I am using Nokia E63 (answers.com/topic/nokia-e63) and my OS is : Symbian OS9.2, S60 3.1 Edition –
Martellato
According to en.wikipedia.org/wiki/S60_%28software_platform%29 your E63 has FP1 (Feature Pack 1), and the API is only supported from FP2 onwards. –
Atmometer
Yes, that makes sense. So this code will work only for some handsets. Is there anyway to make it work for all (eg. my handset)? and thanks for your patience :) –
Martellato
To minimize application use following line of code::
Display.getDisplay (MIDLET_CLASS_NAME).setCurrent (null);
to get the screen back use the following:
Display.getDisplay (MIDLET_CLASS_NAME).setCurrent (myCanvas);
Where myCanvas is your canvas instantiation
this does not work on all models. (Works on Nokia s60, SonyEricsson, but not on Nokia s40, Samsung and some others.
...Your answer does not do justice to my question. How do I minimize the application when the exit button of the cellphone is pressed? In nokia, its a red button. WHen you press that button, the application automatically exits. However, for a S60 , for some select applications (eg. Opera mini) when you hit the exit button, the application gets minimized. I want to do the same thing with my application. How do i do it? –
Martellato
Hey Dude check this article => 2.2 Interaction requirements, pausing the application mobileappstesting.com/tag/… –
Ineluctable
I read the article but its not clear how i can implement this? DO i need to override a method of my midlet which will capture the 'End Key' (red button) and then call some function to minimize the display? Can you provide some sample code? –
Martellato
dude some mobiles when you press "Red Button(End Key)" application will be minimize automatically, I never handled "Red button" key press before, so i don't have sample code for that, but you can try with key code (which will be applied for red key button "End Key"), that key code i don't know(May be it present or not). –
Ineluctable
have you checked @Telmo answer –
Ineluctable
© 2022 - 2024 — McMap. All rights reserved.