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
angelo_f
Posts: 64
Registered: ‎05-06-2009
My Device: Not Specified
Accepted Solution

Updateing UI and event threads

Greetings

I understand that any UI that is updated must be done from the event thread.

The get event documentation says regarding getEventLock

An application should never call notify or wait on this object.

Does this mean you should never call
        synchronized (Application.getEventLock()) {

I saw this in another thread, and as such you should probably call
UiApplication.getUiApplication().invokeLater(new Runnable() {

So the question is that if from a menu, id do
        menu.add(new MenuItem("Edit Attachments", ordinal, 10)
        {
            public void run(){doMarkersButton();}}
        );

 

What happens if the function doMarkersButton(); invokes the UI?

 

Will the doMarkersButton function be invoked in the event thread?

 

Thanks

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Updateing UI and event threads

The MenuItem is called from the event thread.

 

 

Developer
angelo_f
Posts: 64
Registered: ‎05-06-2009
My Device: Not Specified

Re: Updateing UI and event threads

so the run method of the menu item is also called in the context of the event thread?
Developer
simon_hain
Posts: 16,364
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Updateing UI and event threads

yes
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter