问题
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?
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/9869653/minimizing-a-mobile-application-on-exit-button-press