I tried several times to figure out how to push a form to a sreen inside a timer task. but meantime it gave me errors. but ultimately i found a way to do it.
The solusion is invokelater(). To run a UI we have to run our code in event-dispatching thred.
class RemindTask1 extends TimerTask
{
public void run()
{
Runnable NextScreen = new Runnable()
{
public void run()
{
UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
UiApplication.getUiApplication().pushScreen(new frmComplite());
}
};
UiApplication.getUiApplication().invokeLater(NextScreen);
}
}
Comments