BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-02-2009, 07:43 AM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Alert Dialog message from background application

Please Login to Remove!

Hi,

I am trying to schedule a background Application at particular interval. When it executes it will fetch data from server and process it. I would like to show message to user if any error/exception occurs.

I searched forum and tried various things to show a Alert Dialog message from my background application but nothing helped. Most of solutions give me "Not in Event Thread Exception"

I referred to

and added following code in my background application.
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);
}
This does not raise any exception but also does not show any dialog. Please help me or refer me to some code example of similar type.
Offline  
Old 09-02-2009, 07:57 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually scratch my previous answer - i see your getting the code from here so i must be wrong:

http://www.blackberry.com/knowledgec...20551&vernum=0

Last edited by hippocamp software : 09-02-2009 at 08:37 AM.
Offline  
Old 09-02-2009, 08:45 AM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by hippocamp software View Post
You don't need to get a handle to the UiEngine. You should just be able to use screen.show(); - although i'd advise against naming your Dialog instances as 'screen', it's a little confusing. Plus you're casting a class of type Dialog to Screen here so you're losing all the things in Dialog that make it a Dialog!
Thanks for responding

I have taken this code from Blackberry Knowledge base. As my number of posts are less than 10 I cannot put direct link here. But you can search for "How To - Alert a BlackBerry smartphone user from a Background application"

I tried following but didn't work

Code:
synchronized(Application.getEventLock()){    
   Dialog alert = new Dialog(Dialog.D_OK, error, Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
   alert.show();
}

Last edited by malani_manish : 09-02-2009 at 08:48 AM. Reason: removed duplicate text
Offline  
Old 09-02-2009, 09:09 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

looks like we posted at the same time - i was wrong when i said the cast would lose methods, i'm misunderstanding something there.

i use the following to display a screen that extends PopupScreen :

invokeLater(new Runnable() {

public void run() {
pushGlobalScreen(new yourPopup(app), 0, yourApp.GLOBAL_MODAL);
}
});
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

5Pcs ICL7107 4 Digit Ammeter DIY Kit Electronic LED Soldering Set
$25.49
5Pcs ICL7107 4 Digit Ammeter DIY Kit Electronic LED Soldering Set pictureYokogawa Type 2013 Class 0.5 Portable Standard AC Ammeter 5/25 Amperes
$52.99
Yokogawa Type 2013 Class 0.5 Portable Standard AC Ammeter 5/25 Amperes picture3Pcs ICL7107 4 Digital Ammeter DIY Kit Electronic LED Soldering Set
$15.49
3Pcs ICL7107 4 Digital Ammeter DIY Kit Electronic LED Soldering Set picture10Pcs DIY 4 Digit Ammeter Kit ICL7107 Electronic LED Soldering Set
$50.99
10Pcs DIY 4 Digit Ammeter Kit ICL7107 Electronic LED Soldering Set pictureLot of 2 Yokogawa DB40 Panel AMMETER RPM 103111FAFA7YAG Current Amp Analog 4.75"
$99.99
Lot of 2 Yokogawa DB40 Panel AMMETER RPM 103111FAFA7YAG Current Amp Analog 4.75






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