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


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

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

Forum Jump


Serta Big and Tall Commercial Office Chair Memory Foam 350 Lb Capacity Black NEW picture

Serta Big and Tall Commercial Office Chair Memory Foam 350 Lb Capacity Black NEW

$169.99



Serta Big and Tall Commercial Office Chair Memory Foam 350 Lb Capacity Brown picture

Serta Big and Tall Commercial Office Chair Memory Foam 350 Lb Capacity Brown

$169.99



New In Box SIEMENS 6ES7954-8LF03-0AA0 6ES7 954-8LF03-0AA0 Memory Card picture

New In Box SIEMENS 6ES7954-8LF03-0AA0 6ES7 954-8LF03-0AA0 Memory Card

$246.08



CORSTAT INTEGRATED CIRCUIT EXPANDED MEMORY DIP REV. A SER. B 2711-NM3 picture

CORSTAT INTEGRATED CIRCUIT EXPANDED MEMORY DIP REV. A SER. B 2711-NM3

$174.95



Nightingale CXO 6200 Memory Foam, New Headrest, Lumbar Support Ergo Office Chair picture

Nightingale CXO 6200 Memory Foam, New Headrest, Lumbar Support Ergo Office Chair

$415.00



Brother EM-630 Professional Electronic Daisy Wheel Typewriter FOR PARTS picture

Brother EM-630 Professional Electronic Daisy Wheel Typewriter FOR PARTS

$225.00







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