If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
shnish
Posts: 8
Registered: ‎07-25-2013
My Device: none
My Carrier: none

popscreen method is crashing application

1. The BlackBerry handheld software version and BlackBerry model you are testing with (or simulating). You can find this information under Options, About:   blackberry 9550 simulator

 

2. The version of BlackBerry Java SDK or BlackBerry JDE used to build the application: 
JDE 5.0  Eclipse SDK 3.7.2

 

3. The exact error, exception or behaviour you are experiencing. Try to avoid statements like "it doesn't work".

The error that is thrown is the program crashes then an alert appears saying "Uncaught exception:  Application____ (167) is not responding.  Process termintated"

 

4. If possible, the line of code triggering the error or exception, as well as a snippet of the code that precedes it.

 

invokeLater(new Runnable()
        {
            public void run()
            {
                popScreenNew(screenToPop);
            }
        });

 

(This will basically call popScreen() on the screen but i just wanted to show that it is under an invokeLater())

 

this snippet of code is what I am wondering about:  This basically will pop all but the home screen.

When I run the code with the lines commented, it doesn't work and crashes the application.  When i run with the lines uncommented, it runs correctly.


            try{
//                int counter = 1;
                while( MainApplication.getInstance().getScreenCount() > 1){
                    MainApplication.getInstance().invokeLaterPopScreenNew(MainApplication.getInstance().getActiveScreen());
//                    Dialog.alert("Ran " + counter + " times.");
//                    counter++;
                }
            }catch(Exception e){
                Dialog.alert(e.getMessage());
            }

 

There wwere two other ways i tried this:

1:  I have tried to change the while loop to use instanceof (just in case to try a different version).

2:  I have tried the followingcode snippet but instead of pop screen that throws an error it is pushscreen:

 


          
 /*
             * Cannot use this, throws runtime exception 104
             * throws exception at Screen.setUIEngine()  line:597222
             * MainApplication.getInstance().invokeLaterPushScreenNewAndPopAllScreensNew(DashboardScreen.getInstance());
             */

 

This code throws a different exception which is in the lines above the code.  This throws a catchable error but i dont know why it throws the error.  invokeLater in this case will push the new screen and then pop all but that screen.  It does it in that order.

 

Please use plain text.
Developer
simon_hain
Posts: 15,908
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: popscreen method is crashing application

the exception means you block the UI thread.
see
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.