views:

275

answers:

2

Well, I'm developing a app in my cellphone that is going to connect to my PC, the problem is that everytime that I return a URLRequest to the cellphone, it shows the previous Form on the screen and not de actual one, for example this is what goes in my actionListener:

public void actionPerformed(ActionEvent ae) {
    if (ae.getCommand() == guiaUtil.cSelecionar()) {
        LoginRemote loginRemote = new LoginRemote();

        try {
            //This is the request, returns true or false, does not affect the form
            loginRemote.login(tLogin.getText(), tPassword.getText());
        } catch (Exception e) {

            GuiaUtil.error(e);
            return;
        }
        guiaUtil.mainApp().startMenu();
    }

}

Then in the "guiaUtil.mainApp().startMenu()" I have this

public void startMenu() {
    if (itemsMenu == null) {
        itemsMenu = new List();
        itemsMenu.setWidth(320);

        itemsMenu.addItem("Sincronize Spots");
        itemsMenu.addItem("Find Spots");
        itemsMenu.addItem("Work");
        itemsMenu.setFocus(true);

        this.addComponent(itemsMenu);
        this.addCommandListener(this);
        this.addCommand(guiaUtil.cSelect());
        Form form = new Form();
        form.addComponent(itemsMenu);

    }
    form.show();

}

Anyway, after the request returns, it shows my Login form again, instead of showing the Menu List

A: 

Up.

I have the same problem. Everything is OK on my emulator (i'm coding on NetBeans), but when I test my midlet on a true telephone (a small and slow one), I get this problem.

I first thought I did not call LWUIT method within the EDT. I'm now sure I'm doing this right.

I'm showing a progress dialog box while processing on a separate thread. After processing is done, the thread closes the dialog using Display.getInstance().callSerially.

I thought I had to wait for the first form to fully reapear after dialog box is closed before I call form.show for the second form. I'm now sure all events are in the right order.

And still when I call form.show() the first form is shown again.

Andre Mariano did you manage to do it right ? Thx

Yannik
A: 

Not sure what happens in loginRemote.login(tLogin.getText(), tPassword.getText()); If you access the network, I would put that part in a different thread. Inform the main thread by some kind of callback when the "remote login" is done, you can show the menuForm from the edt then.

endevour