minimizing a mobile application on exit button press

耗尽温柔 提交于 2019-12-22 08:55:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!