Hello,
My Timer seems to always stop whenever I call a display.setCurrent(something);, where display is of type Display.
Here's how the code looks like (modified for brevity):
public void startApp() {
t = new TextBox("ABC", " ", 128, TextField.ANY);
t.addCommand(loginCommand);
t.addCommand(exitCommand);
t.setCommandListener(this);
display.setCurrent(t);
iTimer = new Timer();
iTimer.scheduleAtFixedRate(taskUpdateMsg, 1000, 5000);
...
...
...
}
startApp() created my iTimer, and it works fine. I System.out.println() inside taskUpdateMsg's run() method and it does show up as scheduled.
And then I do this:
public void commandAction(Command c, Displayable s) {
if (c == loginCommand) {
myList = new List("My List", List.IMPLICIT);
myList.addCommand(selectUserCommand);
myList.addCommand(logoutCommand);
myList.setCommandListener(this);
display.setCurrent(myList);
}
...
...
...
}
when it reaches display.setCurrent(myList), the timer stops...but when I try to create it again, I get an error that says something like it's been created or something exception.
Why is this occuring whenever I call Display.setCurrent()?
Thanks.