黑莓 - 全局屏幕修改?

发布于 2024-08-15 05:23:15 字数 522 浏览 1 评论 0原文

我使用以下全局对话框在用户退出应用程序并通知我的应用程序检查某些任务后显示一些消息。

synchronized( UiApplication.getEventLock() ) {
    UiEngine ui = Ui.getUiEngine();
    Screen screen = new Dialog(Dialog.D_OK, "My Message",
        Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), 
        Manager.VERTICAL_SCROLL);
    ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

我想添加此对话框的标题作为我的应用程序标题和一些消息(我已经给出了...)并删除感叹号或为此对话框提供的任何默认图标。但我不想在这个对话框中出现任何图标。

如果您使用过,有人可以推荐我吗?

谢谢。如果您能帮我解决这个问题,我将不胜感激。

I use the following global dialog to show up some message after user exited application and my app notified for checking some task.

synchronized( UiApplication.getEventLock() ) {
    UiEngine ui = Ui.getUiEngine();
    Screen screen = new Dialog(Dialog.D_OK, "My Message",
        Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), 
        Manager.VERTICAL_SCROLL);
    ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

I want to add Title of this dialog as my App Title, and Some message(already i'm giving that...) and remove the Exclamation or whatever default icon has given to this dialog. I don't want ANY ICON though in this dialog.

Could someone please suggest me if you have used it?

Thank you. Appreciate if you could help me out on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相权↑美人 2024-08-22 05:23:15

Dialog 类,我建议使用 PopupScreen 扩展名:
替代文本 http://img187.imageshack.us/img187/6245/9000.jpg< /a>

class GlobalDialog extends PopupScreen implements FieldChangeListener {
    ButtonField mOKButton = new ButtonField("OK", ButtonField.CONSUME_CLICK
            | FIELD_HCENTER);

    public GlobalDialog(String title, String text) {
        super(new VerticalFieldManager());
        add(new LabelField(title));
        add(new SeparatorField(SeparatorField.LINE_HORIZONTAL));
        add(new LabelField(text, DrawStyle.HCENTER));
        mOKButton.setChangeListener(this);
        add(mOKButton);
    }

    public void fieldChanged(Field field, int context) {
        if (mOKButton == field)
            close();
    }
}

使用示例:

class Scr extends MainScreen {
    public Scr() {
        synchronized (UiApplication.getEventLock()) {
            UiEngine ui = Ui.getUiEngine();

            String title = "Dialog Title";
            String text = "Lorem ipsum dolor sit amet, consectetur "
                    + "adipiscing elit. Donec venenatis " 
                    + "condimentum urna, non accumsan magna "
                    + "ultrices ut. Morbi fringilla ";
            GlobalDialog screen = new GlobalDialog(title, text);

            ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
        }
    }
}

根据 Fernando 评论进行更新

There is no title in Dialog class, I would suggest to use PopupScreen extention:
alt text http://img187.imageshack.us/img187/6245/9000.jpg

class GlobalDialog extends PopupScreen implements FieldChangeListener {
    ButtonField mOKButton = new ButtonField("OK", ButtonField.CONSUME_CLICK
            | FIELD_HCENTER);

    public GlobalDialog(String title, String text) {
        super(new VerticalFieldManager());
        add(new LabelField(title));
        add(new SeparatorField(SeparatorField.LINE_HORIZONTAL));
        add(new LabelField(text, DrawStyle.HCENTER));
        mOKButton.setChangeListener(this);
        add(mOKButton);
    }

    public void fieldChanged(Field field, int context) {
        if (mOKButton == field)
            close();
    }
}

Example of use:

class Scr extends MainScreen {
    public Scr() {
        synchronized (UiApplication.getEventLock()) {
            UiEngine ui = Ui.getUiEngine();

            String title = "Dialog Title";
            String text = "Lorem ipsum dolor sit amet, consectetur "
                    + "adipiscing elit. Donec venenatis " 
                    + "condimentum urna, non accumsan magna "
                    + "ultrices ut. Morbi fringilla ";
            GlobalDialog screen = new GlobalDialog(title, text);

            ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
        }
    }
}

UPDATED according to Fernando comment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文