Hello,

I have a program that periodically creates a TimerTask. TimerTask is constructed so that in some particular cases software associates a Alert dialog to it (to be shown by the time TimerTask is invoked). New TimerTasks are created from within Timer's thread context (thus also Alert dialog instances).

Strange thing is that whenever Alert dialog instance is craeted (new Alert(...) in a context described above) Midlet's display is altered by middleware so that current Displayable's title will be replaced with Midlet's name and e.g. Back command vanishes from right softkey.

Here is a midlet that should pinpoint this problem:

MIDlet-1: Ni, a.jpg, com.TimerTest

package com;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Screen;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class TimerTest extends MIDlet implements CommandListener
{
private static final Command CMD_KNIGHTS =
new Command("Knights", Command.SCREEN, 1);
private static final Command CMD_WHO =
new Command("who", Command.SCREEN, 2);

private static final Command CMD_SAY =
new Command("say", Command.SCREEN, 3);

private static final Command CMD_NI =
new Command("Ni!!!", Command.SCREEN, 4);

private static final Command CMD_HELP =
new Command("Help", Command.HELP, 5);

private static final Command CMD_BACK =
new Command("Back", Command.BACK, 6);

private Screen currentDisplayable;
private Display display;
private Timer timer;

protected void destroyApp(boolean arg0)
throws MIDletStateChangeException
{
}

protected void startApp()
throws MIDletStateChangeException
{
timer = new Timer();
timer.schedule(new MyTimerTask(),
new Date(System.currentTimeMillis() + 5000));
display = Display.getDisplay(this);
showDisplayable();
}

protected void pauseApp()
{
}

private void showDisplayable()
{
String[] aString = {"Wait..."};
List l = new List("Hello", Choice.IMPLICIT, aString, null);
l.addCommand(CMD_KNIGHTS);
l.addCommand(CMD_WHO);
l.addCommand(CMD_SAY);
l.addCommand(CMD_NI);
l.addCommand(CMD_HELP);
l.addCommand(CMD_BACK);
l.setCommandListener(this);
display.setCurrent(l);
}

public void commandAction(Command cmd, Displayable d)
{
showDisplayable();
}

private class MyTimerTask extends TimerTask
{
private Alert alertDisplay;

public MyTimerTask()
{
alertDisplay = new Alert("...");
}

public void run()
{
System.out.println("Timer task called...");
timer.schedule(new MyTimerTask(),
new Date(System.currentTimeMillis() + 5000));
}
}
}

As it is possible to implement this desired feature differently I would only like know whether this is a bug in
6600 (V 3.42.1 16-10-03 NHL-10) & Series60_MIDP_SDK_2_0_for_SymbianOS? Or if I managed to fail to respect some midlet implementation specification's / design guideline's omnipotency...