试试下面的代码
public static void main(String[] args) {
if (args.length > 0 && args[0].equals("pus") ){
theApp = new App();
theApp.enterEventDispatcher();
} else {
BackgroundApplication backApp=new BackgroundApplication();
backApp.setupBackgroundApplication();
backApp.enterEventDispatcher();
}
}
BackgroundApplication扩展了应用程序。
try{
final Dialog screen = new Dialog(Dialog.D_OK_CANCEL, "hello",
Dialog.OK,
null,
Manager.VERTICAL_SCROLL);
final UiEngine ui = Ui.getUiEngine();
Application.getApplication().invokeAndWait(new Runnable() {
public void run() {
NotificationsManager.triggerImmediateEvent(0x749cb23a76c66e2dL, 0, null, null);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}
});
screen.setDialogClosedListener(new MyDialogClosedListener());
}
catch (Exception e) {
// TODO: handle exception
}