In BlackBerry development (I’m talking about BB OS 6+), if I want to display another screen upon a button click, I have seen that I can use any of the below methods to do it:
getScreen().getUiEngine().pushScreen(new MyScreen());
and,
UiApplication.getUiApplication.pushScreen(new MyScreen());
Both of the above methods show the new MyScreen screen successfully. But what is the difference between these two? Or are they the same?
Note: What I’m specifically asking is whether they behave differently (on resources) and whether they handle method calls the same way or not. And do they have any discernible effects regarding end-users?
Thanks.
The first method will push the screen onto the stack associated with the application that “owns” the Screen containing the Field (I’m assuming you’re calling Field.getScreen()…).
The second method will push the screen onto the stack of the application that “owns” the thread that executes UiApplication.getUiApplication()…
Unless you are doing some complex background processing or interacting with system applications through ApplicationMenus or some listeners.
The primary effect is on what resources are accessable in each case. If you use application scoped singletons these differences will eventually affect your program. This is one reason RIM recommends the use of system scoped singletons using the RuntimeStore or PersistentStore.
My experperiences developing a particular program my help: http://www.hrbuckley.net/2012/03/blackberrry-singletons-application.html