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.
07-08-2013 11:09 AM - edited 07-08-2013 11:18 AM
I would like to know how to get a reference to the current Application through code. I would like to be able to access my NavigationPane on my applications main screen from anywhere in my code so that I can push and pop screens.
I guess I'm trying to do something like:
Or am I going about the pushing and popping the wrong way? I undertsand the idea of pushing and popping screens from a NavigationPane, I would just like to know how to do this from any screen.
07-08-2013 12:08 PM
If you look at the class hierarchy, above bb::cascades::Application you'll get to bb::Application and then QCoreApplication, where there's an instance() static method that does what you want.
07-08-2013 12:22 PM - edited 07-08-2013 12:24 PM
Could you show me an example of how I would create the reference??
Something like this??:
QCoreApplication *instanceOfApp = QCoreApplication.instance();
This doesn't work though.
07-08-2013 12:24 PM
07-08-2013 12:26 PM
07-08-2013 12:27 PM - edited 07-08-2013 12:46 PM
Sorry about not providing more info, it was a syntax error:
error: expected primary-expression before '.' token
I was trying to use the dot operator where I shoud've used ::
It seems to be working so far. Thanks alot for your help!