Here is the code as requested
Calling the alert:
Code:
timer.schedule(new TimerTask(){
public void run(){
Alert codeExpiry=createAlert("Your current token has expired. Close this alert and a new token will be displayed", AlertType.INFO);
Display.getDisplay(midlet).setCurrent(codeExpiry);
}
},APPLICATION_TIME_OUT_SECONDS * 1000);
CreateAlert method:
Code:
public static Alert createAlert(String message, AlertType type) {
Alert msgBox = new Alert("Mi-Token", message, null, type);
msgBox.setTimeout(Alert.FOREVER);
return msgBox;
}