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
Posts: 79
Registered: ‎01-01-2009
My Device: Not Specified
Accepted Solution

invokeLater method

public final int invokeLater(Runnable runnable,long time, boolean repeat) method

 

"puts runnable object into this application's event queue for repeated execution"

 

That's great but does anyone know how to stop the thread being executed ?

 

Say for instance:

 

UiApplication.getUiApplication().invokeLater(new Runnable
{

public void run()
{
try {}

catch (Exception e) {}

}

}, 50, true);

 

Since there is no direct reference to the anonymous runnable object   I cannot not find any way to kill the thread after a certain condition has been reached.

Any ideas?

 

Thanx.

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

Re: invokeLater method

you have to use another way. for example a timer+timertask.

----------------------------------------------------------
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
Developer
Posts: 79
Registered: ‎01-01-2009
My Device: Not Specified

Re: invokeLater method

:smileyhappy: thanks, I use the timer indeed, but I was just wondering if there was a way to stop the Runnable object thread.

It could make my life a bit easier.

 

Well, I could not find any.

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: invokeLater method

 

final int runnableId = app.invokeLater(runnable, 50, true);
...
app.cancelInvokeLater(runnableId);

 

 

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

Re: invokeLater method

so i learn something new - not looking at the api to answer the question fired back :smileyhappy:

----------------------------------------------------------
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
Developer
Posts: 19,621
Registered: ‎07-14-2008
My Device: Not Specified

Re: invokeLater method

"so i learn something new"  Me too.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: invokeLater method

I'm glad I could help. :smileyhappy:

Developer
Posts: 79
Registered: ‎01-01-2009
My Device: Not Specified

Re: invokeLater method

that's neat.

 

It works

thanks a bunch.