views:

286

answers:

1

Hello all,
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.

+2  A: 

There is no title in Dialog class, I would suggest to use PopupScreen extention:
alt text

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 ";
      Screen screen = new GlobalDialog(title, text);

      ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
     }
    }
}
Max Gontar
WoW! Excellent help. Works Great! I have one more question is, if i want to show the dialog and make the device screen ON if the device screen is already in OFF state, can it be possible?
You're welcome! Post separate question about display, so it will be dedicated and indexed by search machines :)!
Max Gontar