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
Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer
My Carrier: Developer

How to delay a function call ?

Hi,
Please I need help making a delayed call to my function.
Example:

void myfunction1(){....}
void myfunction2(){....}
void myfunction3(){....} 

void onNFCdetected(){

 

myfunctions1();

myfunctions2(); // delay this call 3 seconds, but do not put the application on halt, continue to the following call
myfunction3(); // delay this call 2 seconds, and also do not stop application untill the 2secs pass (like executing call in background)

 

Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer
My Carrier: Developer

Re: How to delay a function call ?

Thanking everyone in advance for thr help...
If any details needed please let me know ...

My aim from this is To make my application make calls for functions on NFC detected ..but I want these function to execute say after 3 seconds from the NFCdetection.

Thanks again. 

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

Re: How to delay a function call ?

to delay execution without stopping the application you can use a separate thread.
if your call does not block, you can also use timer+timertask, which is simple to use.

all potentially blocking code should be executed on a separate thread.
----------------------------------------------------------
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