Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
babyblue_lee
Posts: 130
Registered: ‎08-10-2010
My Device: Not Specified

Still got IllegalStateException after synchronizing the event log

Hi,

 

I've been running into this annoying IllegalStateException these days, when trying to invoke setText() method of some fields. Interestingly, it used to work a few days before.

 

Now, even if I synchronize the event lock before doing so, I still get the IllegalStateException.

 

synchronized(UiApplication.getEventLock()){

            EditField.setText("abc");       

}

 

Can someone help on this?

Please use plain text.
Trusted Contributor
babyblue_lee
Posts: 130
Registered: ‎08-10-2010
My Device: Not Specified

Re: Still got IllegalStateException after synchronizing the event log

In fact, I'm trying to change the screen of another application, which is stored in RunTimeStore.

 

I've tried the code example in KB article http://supportforums.blackberry.com/t5/Java-Development/Update-a-screen-on-the-Main-Event-Thread/ta-....

 

Still not working.

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: Still got IllegalStateException after synchronizing the event log

It would be useful to know the description of the IllegalStateException.  I suggest you print it out when you get one of these, it will help in the diagnosis.

 

In this case, I'm pretty sure the problem is caused because you are trying to update the Screen associated with another application.  If you want to update that Screen you will have to 'context switch' to that other application.  The easiest way to do this is to send the other Application a Global Event, and have the other Application, as a Global Event Listener, update its own screen. 

Please use plain text.