BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-27-2007, 12:59 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2006
Model: 7290
Carrier: Airtel
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default MIdlet throws "PushModalScreen called by a non-event thread"

Please Login to Remove!

Hi everybody,

I have a j2me midlet working fine on other devices like Nokia, Sony. But, when i run the same application I am getting the error message as "PushModalScreen called by a non-event thread".


1. What could be the reason?
2. Is there any special consideration that I need to take care when developing midlets for BlackBerry?

Thanks and Regards,
Kamal
Offline  
Old 04-27-2007, 03:30 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

on a native blackberry application you'd use:

UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
UiApplication.getUiApplication().pushScreen(new myPopup());
}
});

but i'm not sure how to do the same in a midlet, what's happening here is a background thread is attempting to push a screen from a thread other than the main event thread which handles the ui. as it's modal it's blocking which is why the blackberry os doesn't like it; a background thread blocking the ui thread. to get around this on a native app without using invokeLater we'd use Status.shopw("message"); instead of Dialog.inform("message"); or similar, again, not sure on how to do it in a midlet but hope this helps.

cheers,
jon
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 04-27-2007, 03:38 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2006
Model: 7290
Carrier: Airtel
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

jfisher,

Thanks for your response.

Since, I m developing midlet, I would like to know if there is any work around for the same.

--
Kamal.
Offline  
Old 04-27-2007, 01:11 PM   #4 (permalink)
CPO
New Member
 
Join Date: Apr 2007
Location: Ottawa
Model: 8100
PIN: N/A
Carrier: Rogers
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I take it that this is happening when displyaing an Alert? You should be able to use the callSerially() method of the MIDP Display class to run code on the event thread. This will require adding some code similar to jon's example - showing the Alert from within a Runnable object and passing an instance to Display.callSerially()
Offline  
Old 04-28-2007, 11:54 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2006
Model: 7290
Carrier: Airtel
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi CPO,

I will try and let you know the result

Thanks for your response.

Kamal.
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.