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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
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.

 

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
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