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?
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!
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()