开发者

Show a Dialog Box from non event thread

开发者 https://www.devze.com 2023-01-22 04:19 出处:网络
I need to show a Dialog box, from an app started via an alternate entry point, when a push message arrives.

I need to show a Dialog box, from an app started via an alternate entry point, when a push message arrives.

To do this I need to create an Application instance from the alternate entry point and listen for incoming push.

The problem is when I extend my application class from UiApplication, and call enterEventDispatcher() from the alternate entry point it shows an application icon in running applications forever.

I need to listen for push messages and alert user by a dialog without having an application icon开发者_Python百科.

So is there any way I can show a dialog from an alternate entry point without a UI event thread?


You can use global dialog. Just use this code.

synchronized (Application.getEventLock()) {
    UiEngine ui = Ui.getUiEngine();
    Screen screen = new Dialog(Dialog.D_OK, "Look out!!!", Dialog.OK,
                               Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
                               Manager.VERTICAL_SCROLL);
    ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消