Blackberry closing UiApplication Alternative Entry Point

左心房为你撑大大i 提交于 2019-12-11 12:27:35

问题


I have a requirement to have a background process using Application, while also having a UiApplication through an alternative entry point.

Now, everything works great and I'm able to communicate between them fine, apart from when it comes to telling the UiApplication to close from the background process.

I've tried a number of methods:

UiApplication.getUiApplication().requestClose() doesn't work.

I've tried setting a boolean value to true, which the UiApplication checks every second to see if it's true or not, if so, it closes itself. Doesn't work...

UiApplication.getUiApplication().invokeLater(new Runnable(){
     public void run(){
          System.exit(0);
     }
});

Anyone have experience in this who can point me in the right direction?


回答1:


Background and Foreground are different processes and they aren't sharing data memory. So basically you can't set any boolean in one app and just check it in another.

But since you have communication between two apps already, probably using ApplicationManager.postGlobalEvent(), you can add another event "Exit".



来源:https://stackoverflow.com/questions/13528367/blackberry-closing-uiapplication-alternative-entry-point

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