Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
anicangu
Posts: 94
Registered: 01-13-2011
Accepted Solution

push or pop screen

What is the difference between pushscreen and popscreen?

 

I am trying to make the flow of screen using this piece of code to pass to next screen,

 

UiApplication.getUiApplication().invokeLater(new Runnable(){
     public void run() {
         UiApplication.getUiApplication().pushScreen(nextScreen);
     }
});

 

but I noted previous screen is still opened even if nextScreen is pushed.

 

What should be right way to swich screens?

Please use plain text.
Developer
arkadyz
Posts: 2,146
Registered: 07-08-2009
My Carrier: various

Re: push or pop screen

Displayed Screens in BlackBerry UI Applications are kept in a stack, called Screen stack. The top of the stack is so called "active Screen" - the only Screen which can get user's input. Screens which are closer to the top obscure those deeper down.

 

pushScreen puts a (previously undisplayed - otherwise it will throw an exception) Screen on top of the Screen stack, which makes it active. popScreen removes the activeScreen (if no parameters are given - this functionality is deprecated) or the specified Screen (if displayed - again, will throw an exception otherwise) from the Screen stack. If the top (active) Screen is popped, the one below it becomes the top one - accepting user's input and unobscured.

 

That's it! Design your application the way you see fit, but with this picture in mind.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Developer
Astarot82
Posts: 53
Registered: 10-29-2010

Re: push or pop screen

With pushScreen() you'll push a Screen into the stack. If you pop a Screen, you're removing it from the stack.

 

I think your problem is that can't push a Screen in top of the others if you don't pop it before.

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: 12-27-2010

Re: push or pop screen

I'm not sure if I read Astarot's post correctly -- it's been a long week already -- but want to make sure that it's clear that you can push more than one screen onto the stack (i.e., you don't have to pop a screen before you push another screen). Are you getting any Exceptions when you try to push the screen? Also, could you possibly post a little more code, like what is making this call just in case the bug is actually in another part of the program.

Please use plain text.