Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

minimizing a mobile application on exit button press

Tags:

java-me

lwuit

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?

like image 493
Nikhil Avatar asked Jan 18 '23 02:01

Nikhil


2 Answers

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

like image 124
Telmo Pimentel Mota Avatar answered Apr 27 '23 22:04

Telmo Pimentel Mota


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.

like image 42
Mr. Sajid Shaikh Avatar answered Apr 27 '23 22:04

Mr. Sajid Shaikh