How Do I Minimize a J2ME App?

前端 未结 5 682
清酒与你
清酒与你 2021-01-05 09:21

I need my J2ME app to run in the background and still allow the user to use his mobile without problem. the app still needs to process some events in the background.

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 09:48

    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).

提交回复
热议问题