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.