BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-01-2009, 05:11 AM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Model: 9000
PIN: N/A
Carrier: O2 UK
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default OK on dialog in background app

Please Login to Remove!

Hi

I have an app which extends Application - in other words, it has no UI.

If it fails, I need to display a dialog to the user before quitting. So I use the following code:

Code:
    public void message(String text)
    {
       synchronized(Application.getEventLock())
       {    
            UiEngine ui = Ui.getUiEngine();
            Screen screen = new Dialog(Dialog.D_OK, text, Dialog.OK,
                                       Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
                                       Manager.VERTICAL_SCROLL);
            ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
        }
    }
The problem is, if I do:

Code:
message("Error - exiting application");
System.exit(1);
...the dialog box flashes up and disappears. I guess this is because there is no app owning the dialog.

Is there a way to wait until OK has been pressed before exiting?

Thanks

Simon
Offline  
Old 04-01-2009, 10:35 AM   #2 (permalink)
Knows Where the Search Button Is
 
andreybutov's Avatar
 
Join Date: Dec 2006
Location: New York City
Model: Many
Carrier: Multiple
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The third parameter into pushGlobalScreen(...) takes an "inputRequired" boolean. Set that to true and you'll be all set.

Cheers!
__________________
Antair BlackBerry Software
A spam filter for a cleaner inbox, a call screener to block calls, and more great BlackBerry tools.
www.antair.com
Offline  
Old 04-01-2009, 10:53 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

public void pushGlobalScreen(Screen screen, int priority, boolean inputRequired) is deprecated since 4.2.0.

use
Quote:
UiEngine.GLOBAL_MODAL -- block until the screen closes
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Old 04-01-2009, 10:55 AM   #4 (permalink)
Knows Where the Search Button Is
 
andreybutov's Avatar
 
Join Date: Dec 2006
Location: New York City
Model: Many
Carrier: Multiple
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Antair targets 4.1 devices and higher, so we build with 4.1 -- works fine on everything from 4.1 to 4.7 -- deprecated != removed or unusable.
__________________
Antair BlackBerry Software
A spam filter for a cleaner inbox, a call screener to block calls, and more great BlackBerry tools.
www.antair.com
Offline  
Old 04-02-2009, 08:26 AM   #5 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

cannot imagine something is working fine on 4.7 device in compatibility mode... excepting there is no GUI of course...
you are right deprecated != removed, at least for the moment.

just to quote a RIM's guy: "It is recommended to avoid deprecated APIs. An API is marked as deprecated to inform developers that it could be removed in the future. The JavaDocs for deprecated APIs typically direct to the recommended replacement API."
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.