I'm using a button in a screen to close a screen and there is a listener which catch that event and opens a new screen.
but the main menu appears automatically for some reason on the new screen in the simulator.
i'm using jde 4.2.1 and 4.5.0
maybe it's only a problem with the simulator? because it happens if i click the track ball when i'm on the button in screen1, but it doesn't happen if i use the enter key on the pc keyboard...
App.java:
Code:
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
public class App extends UiApplication implements ScreenClosedListener
{
Screen1 screen1;
Screen2 screen2;
public static void main(String[] args)
{
App app = new App();
app.enterEventDispatcher();
}
public App()
{
screen1 = new Screen1(this);
pushScreen(screen1);
}
public void notifyScreenClosed(MainScreen screen)
{
// check the event source object
if (screen == screen1)
{
pushScreen (new Screen2());
}
}
} Screen.java:
Code:
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
final class Screen2 extends MainScreen
{
public Screen2()
{
super();
setTitle(new LabelField("Screen2"));
}
public boolean onClose()
{
return super.onClose();
}
} ScreenClosedListener.java:
Code:
import net.rim.device.api.ui.container.MainScreen;
public interface ScreenClosedListener
{
public void notifyScreenClosed(MainScreen screen);
}