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

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

TimerTask.scheduleAtFixedRate for countdown not at a stable call

I was hope someone can help... All replies appreciated and Thank you in Advance...

I am facing the following problem,  I have the a timertasker that I use inside a screen, that changes the UI when a certian period has passed (each 1sec=change countdown that I display for the user  And each 10sec=I delete a  manager and add another...)
However after a while of playing/using the application I can notice that the countdown starts goin down so fast, i think this means that scheduleAtFixedRate has change to lower value, and the call is not set any more at "timertask.scheduleAtFixedRate(ttt, 100, 100);"  which was the original value set for it.

------------This is the Code-------------
private TimerTask tt;

public final static Timer ts1=new Timer();
------------inside my screen I run this code---------
new TimerTask() {
public void run() {

else if(counter==10){

//some code works
//on if(SecondPassed is true)

ts1.scheduleAtFixedRate(ttt, 100, 100);

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

Re: TimerTask.scheduleAtFixedRate for countdown not at a stable call

why do you schedule it for 100ms? one second would be 1000ms.
instead of counting up i would suggest to start a second timertask with 10 seconds.
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