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
Contributor
Posts: 41
Registered: ‎11-08-2011
My Device: Blackberry Torch
My Carrier: ATT
Accepted Solution

Spawning thread in another entry point

Im looking to develop an app that has a background service and a GUI front end (2 entry points).  I understand how to have a shared runtime store so that the GUI may access data/events from the background service.  But how can I spawn a thread as part of the background entrypoint, while in the GUI entrypoint.  Should I call app.invokeLater() on the background app?  Is that illegal to do if you are not in the context of that app? 

Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Spawning thread in another entry point

i would suggest to use global events or the runtimestore.
----------------------------------------------------------
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
Contributor
Posts: 41
Registered: ‎11-08-2011
My Device: Blackberry Torch
My Carrier: ATT

Re: Spawning thread in another entry point

Thank you for your response.  I think I should clarify my question:

 

Say that there is a runtime store object with a method that I can call to have the background app do something.  In this method a thread will be spawned.  But I want this thread running in the context of the background app, not on the UI app that called the method.  How do I acheive this?

Highlighted
Developer
Posts: 16,842
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Spawning thread in another entry point

send your background application a notification using the global event.

invokelater on the application instance should also works, but seems somehow dirty to me
----------------------------------------------------------
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
Contributor
Posts: 41
Registered: ‎11-08-2011
My Device: Blackberry Torch
My Carrier: ATT

Re: Spawning thread in another entry point

You are right, that works!  Thank you.