IllegalStateExecption when you press FolderListener screen

Trying to push a new screen when an e-mail arrives. the application is configured to run at startup. Looks workfine, but the application itself has a FolderListener, which expects an upcoming email, then tries to push a screen. The problem seems to be when I try to push a screen to the listener... I get "IllegalStateException.

Launcher:

class Launcher extends UiApplication
{
    public static final long APP_ID = 0xf46f5a7867d69ff0L;

    public static void main(String[] args)
    {
        // Create a new instance of the application.
        Launcher theApp = null;
        RuntimeStore runtimeStore = RuntimeStore.getRuntimeStore();

        boolean isGui = (args != null && args.length > 0 && args[0].equals("gui"));

        if (isGui)
        {
            synchronized (runtimeStore)
            {
                theApp = (Launcher)runtimeStore.get(APP_ID);
            }
        }

        if (theApp != null)
        {
            theApp.requestForeground();
        }
        else
        {
            theApp = new Launcher(isGui);
            synchronized(runtimeStore)
            {
                runtimeStore.put(APP_ID, theApp);
            }
            theApp.enterEventDispatcher();
        }

    }

    public Launcher(boolean isGui)
    {
        this.pushScreen(new someScreen(isGui));
    }

}

FolderListener:

  public void messagesAdded(FolderEvent e)
    {
        UiEngine ui = Ui.getUiEngine();
        ui.pushScreen(new bbFindScreen(true));
    }

No - you are always in the listening thread.

Basically, you create an executable object that carries out the operation of the user interface (like your screen push button) and send it to UiApplication.invokeLater)

You must have a reference stored on your UiApplication instance (if you try UiApplication.getUiApplication () form the thread of listening, you're going to get something invalid).

I think that our message listener code actually sending a world event ourselves, we cathc in a global event listener. From there on, we invoke the dialog using UiApplication.invokeLater (). You will also probably want to push this global/modal screen.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • Want TO J6S79AV 23: Graphics drivers do not last

    Its been almost a year now. I love my computer. I have upgraded to Windows 10 with no probliems. Then, a few months later (now), my graphic drivers stopped working. I thought that the problem was easy to fix, because I don't update my drivers, never.

  • How the output voltage is coded on 16 bits DAQmx devices?

    In our laboratory, we have two devices DAQmx, the NOR-PCIe-6363 and the NOR-PCI-6733. Both have 16-bit for bipolar analog output precision. I understand that the small voltage difference that can be made is 2 * Vref/2 ^ 16, where Vref is the referenc

  • How to load dynamically an inspection of PC previously built in VBAI 3.6?

    Hello world A 1744 SmartCamera jointly with VBAI 3.6 and LabVIEW 7.1.1 is used to conduct inspections on a test bench. Inspections are created in VBAI 3.6, communication between LabVIEW and VBAI is done through ActiveX. For memory used on the SmartCa

  • How to store and update the cache to the 2.3 OHC?

    We have a few dozen workflows (CPO 2.3 process) each triggered by a single event of the tide to start. Each workflow at the outbreak extracts digital data (two or three data double-digit like for example 15, 300) from one end of point plural web serv

  • Automatic IP failure

    We connected a number of clients to the server and DHCP is configured on the server. Earlier, everything worked well, but as of today, many customers is not connection to the RDP server. When the DHCP protocol is configured on the server, all clients