How to send MIDlet to background
Article Metadata
Compatibility
Platform(s): MIDP
Device(s): Symbian
Article
Keywords: background, foreground, java, j2me
Created: Aleksi
(03 Apr 2007)
Last edited: hamishwillee
(27 Mar 2013)
This articles shows how to use setCurrent(null) to send a foreground application to the background - on Symbian.
Warning: On Series 40 phones this approach does not work.
The setCurrent(null) doesn't set the displayable to null but is used in Java ME implementations that support concurrent applications like Symbian to send the foreground application to background. The application that is shown is the last application that was shown before the MIDlet got activated. For example, if user launched the MIDlet from application shell just before then application shell is shown.
Following code can be used to send MIDlet to background:
Display display = Display.getDisplay(myMIDletClass);
display.setCurrent(null);
How to get it back
To get a background app back to the foreground, call setCurrent() with a Displayable. If you don't want to change the current Displayable, use:
display.setCurrent(display.getCurrent());


Hamishwillee - Graham, can you help me with some clarifications?
Hi Graham
Just FYI, I subedited this article to mark the inline code using Icode macro (makes is appear monotype). I also added a clearer warning that this only works for Symbian and not series 40.
Can you confirm whether this works for Belle, and what device you tested it on? Any early platforms it is actually tested on?
Lastly, is there something equivalent on Series 40 - or are all apps run in foreground on that platform. Is there anything "equivalent"?
Regards
Hamishhamishwillee 02:06, 27 March 2013 (EET)