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
Developer
dmglakewood
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

java.lang.IllegalStateException: UI engine accessed without holding the event lock.

[ Edited ]

I don't  get it I've tried everything =/

 

 

synchronized(UiApplication.getApplication().getEventLock()){
//Run code
}
synchronized(UiApplication.getApplication().getAppEventLock()){
//Run Code
}
UiApplication.getUiApplication().invokeLater(new Runnable(){ 
public void run(){
//Run Code
}
}
UiApplication.getUiApplication().invokeAndWait(new Runnable(){ 
public void run(){
//Run Code
}
}

 

 

Everything I try thorws the same "UI engine accessed without holding the event lock" error. Is there something I'm not trying or looking past?

 

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: java.lang.IllegalStateException: UI engine accessed without holding the event lock.

Since those should work, I think we need to look elsewhere.

 

Is there a chance you are trying to update some other process's UI?  For example, you are running in a call listener (i.e. under control of the phone application) and trying to update your own Screens?

Developer
dmglakewood
Posts: 296
Registered: ‎12-07-2008
My Device: Not Specified

Re: java.lang.IllegalStateException: UI engine accessed without holding the event lock.

 


peter_strange wrote:

Since those should work, I think we need to look elsewhere.

 

Is there a chance you are trying to update some other process's UI?  For example, you are running in a call listener (i.e. under control of the phone application) and trying to update your own Screens?


 

Yes I'm trying to update my app when the phone call is disconnected using the phone listener.

 

Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: java.lang.IllegalStateException: UI engine accessed without holding the event lock.

If you're sure you're running two processes here (I'm not sure here if you are or not), then you're going to need to use some sort of IPC like RuntimeStore or GlobalEvents to signal between processes.

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: java.lang.IllegalStateException: UI engine accessed without holding the event lock.

Just to agree with ydaraishy, these will be running in two different processes, so you do need to use some Inter Process Communication.  I would recommend you use Global Events, here is the KB article that should get you going on this:

 

What Is - Global Events and Global Event Listeners
Article Number: DB-00145
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is...