How Do I Minimize a J2ME App?

蹲街弑〆低调 提交于 2019-11-30 19:51:25

Running a midlet in the background but still processing is not specified in the j2me standard i think. Normaly at the moment your midlet is moved to background the paused method should be called.

But not every vendor implements it that way. Symbian keeps your program running as if there was no change when minimized. At least on the N80 and N90.

A device's ability to run an application in the background depends on its ability to multitask. Therefore, more expensive, PDA-type devices are more likely to support background execution than lower-cost devices. For in background :-

 private Display display = Display.getDisplay(this);
 private Displayable previousDisplayable;

 public void toBack() {
 previousDisplayable = display.getCurrent();
 display.setCurrent(null);
 }

And foreground :-

public void toFront() {
display.setCurrent(previousDisplayable);
}

But Be aware that every device not supports that features.(Works on Nokia s60, SonyEricsson, but not on Nokia s40, Samsung and some others).

This is not always supported, but on the handsets that do, the command is:

Display.getDisplay(theMidlet).setCurrent(null);

If you app is in background then it doesn't receive any events. So I don't know how it can process any event in the background. If its a preload J2ME app then you can work with the handset manufacturer and obtain certain jad attributes to put your midlet in background. You can thus not allow the user to exit the app. You may want to think this use case through.

On the other hand you can do all these in Blackberry apps.

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