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

New Developer
Posts: 5
Registered: ‎05-11-2009
My Device: Not Specified
Accepted Solution

How to check a timertask schedule is still active or not ?




I created the following code :


 class StateTracker extends TimerTask
        private Timer timer;
        public StateTracker()
            timer = new Timer();
            timer.schedule(this,  5000, 150000 ); // starts after 5seconds repeat the task every 150sec

        public void run()





The code runs allright, except, under certain circumstances, the task task stopped after a few periodic run( I suspect is disconnected network ). Is there any API I could use to check if the schedule is still active or not.


I would like to reschedule the timertask if the original schedule has been disrupted.




Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to check a timertask schedule is still active or not ?

timertasks should not be used for blocking processing. i would suggest to put the real workload into an own thread.

as long as the run code is surrounded with exception handling the execution should continue. there is no method to check if the timer is running correctly.

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