How to make a J2ME application run in Background?

后端 未结 2 1796
情话喂你
情话喂你 2021-02-06 04:37

I have a written a J2ME application which uses Bluetooth and search a file within the peer mobile and download it. I would like to make my application run in background , whenev

2条回答
  •  粉色の甜心
    2021-02-06 05:31

    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 to come in Fore ground :-

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

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

提交回复
热议问题