BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-02-2009, 07:43 AM   #1
malani_manish
New Member
 
Join Date: Jul 2009
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 10
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
hippocamp software
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
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
malani_manish
New Member
 
Join Date: Jul 2009
Model: 9000
PIN: N/A
Carrier: Vodafone
Posts: 10
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
hippocamp software
Thumbs Must Hurt
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: T-Mobile
Posts: 67
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


MSA Altair 4X Multigas Monitor Detector Meter O2,H2S,CO,LEL picture

MSA Altair 4X Multigas Monitor Detector Meter O2,H2S,CO,LEL

$129.98



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$340.00



MSA Altair 4X Multi Gas Detector picture

MSA Altair 4X Multi Gas Detector

$160.00



MSA Altair 5X Multi Gas Detector - COMB,, CO, H2S ,CL2    Color Screen Version picture

MSA Altair 5X Multi Gas Detector - COMB,, CO, H2S ,CL2 Color Screen Version

$500.00



MSA ALTAIR H2S SINGLE GAS DETECTOR 10071361 picture

MSA ALTAIR H2S SINGLE GAS DETECTOR 10071361

$217.55



MSA ALTAIR O2 SINGLE GAS DETECTOR 10071364 picture

MSA ALTAIR O2 SINGLE GAS DETECTOR 10071364

$217.55







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