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

Reply
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

How to open push a new screen and pop the existing one?

Hello,

 

Let's say that I am on Screen A and I push a button to load Screen B. What is the best way to load Screen B and to remove Screen A?

 

In other words, there are many instances in which I need to open, or push, a new screen and I want to close, or pop, the pre-existing one. I have tried to do this a couple of ways but I keep receiving errors.

 

Thanks!

Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: How to open push a new screen and pop the existing one?

Hi

did u tried with

 

                  UiApplication.getUiApplication().popScreen(activeScreen);

                  UiApplication.getUiApplication().pushScreen(nextscreen);

 

please use the 'search'  option in this forum. you will get lot many samples on this topic.

Thanks and Regards,
PraveenGoparaju.
Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: How to open push a new screen and pop the existing one?

You should probably push before you pop just to make sure it will not exit the app if you only have one screen on the stack (not sure if this can actually happ, but why chance it).

Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: How to open push a new screen and pop the existing one?

That works for me, and thanks for the tip!

Contributor
Posts: 36
Registered: ‎02-16-2010
My Device: Blackberry Bold
My Carrier: INWI

Re: How to open push a new screen and pop the existing one?

hi

i tried the solution but it doesn't work for me it give me an exception : illegalstatexception

 

please any idea ?

Highlighted
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: How to open push a new screen and pop the existing one?

It sounds like you are calling pushScreen and/or popScreen from a worker thread instead of the event thread.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.