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: 9
Registered: ‎10-07-2011
My Device: blackberry torch
My Carrier: airtel

cannot push global screen of my uiapplication when message is clicked in the message list app of blackberry

Hi I have made an application for facebook/gtalk in which when the user is in the background he should get message notifications and when he clicks on the messages. he should see the message in the custom screen which i have created for the uiapplication. I am doing this by pushing a global screen .but is raising a IllegalStateException.I donnot know why.if this is not the right way ..please direct me .

New Contributor
Posts: 9
Registered: ‎10-07-2011
My Device: blackberry torch
My Carrier: airtel

Re: cannot push global screen of my uiapplication when message is clicked in the message list app of blackberry

Actually the thing is ..My app is a gtalk client And when ever app goes in the background .new chat messages should appear in the blackberry message app.I integrated my app with the bbmessage app.when I get a message(whenever my app is in background) i create a chat screen using a thread running in background for my uiapplication.  But when ever i click on the chat message in the bbmessage app .I push a that chat screen as global screen but it raises an illegal State Exception.please help 

Developer
Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: cannot push global screen of my uiapplication when message is clicked in the message list app of blackberry

welcome to the support forums.
usually an illegal state exception has a meaningful detail message, for example "ui accessed without event lock", which would mean you have to use invokelater or another method to gain the eventlock.
----------------------------------------------------------
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
Highlighted
New Contributor
Posts: 9
Registered: ‎10-07-2011
My Device: blackberry torch
My Carrier: airtel

Re: cannot push global screen of my uiapplication when message is clicked in the message list app of blackberry

this is the code  in an class which extends Application menu item  's run

 

                UiAppliacation.getUiApplication.invokelater(new Runnable()
                {
                    public void run() {
                               
                                UiApplication.getUiApplication().pushGlobalScreen(theScreen,0,UiEngine.GLOBAL_MODAL);
                                 if(ScreenManager.getNotificationCountIndicator()<=0)
                                 {
                                     AlertManager.changeApplicationIcon(Constants.APPNORMALICON);
                                     LED.setState(LED.STATE_OFF);
                                 }
                                 ScreenManager.SetNotificationTrayIndicator(ScreenManager.getNotificationCountIndicator()-1);
                                 //AlertManager.stopBackgroundAlert();
                        }
                    });
                }
               

I have taken all  the locks .I guess lock is not a problem. there is something else.

I tried using locks.

 

 

 if i create a screen  when my application is in the back ground  the different managers are not properly initialized(i guess)and when i push that screen globally it raises an illegal state exception and the reason is field.assertlayoutcomplete 

 

 

or when i create a screen in the background and push my screen using Uiapplication.getUipplication.requestForeground .it works properly.

 

 

please help.

 

 

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: cannot push global screen of my uiapplication when message is clicked in the message list app of blackberry

first, use:

synchronized (UiApplication.getEventLock()) {

 instead of:

UiAppliacation.getUiApplication.invokelater(new Runnable()
                {

* You can omit the runnable object.

 

 Second, use:

UiApplication.getUiApplication().pushGlobalScreen(theScreen,0,UiEngine.GLOBAL_QUEUE | UiEngine.GLOBAL_MODAL);

 E.