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: 142
Registered: ‎06-26-2009
My Device: Not Specified

How to flush the all the screens from Stack

Hi,

 

Is there any way to flush all the available screens on stack, then push the new screen to stack.

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

Re: How to flush the all the screens from Stack

you can retrieve the active screen and use popscreen while it is not null. or rework your code not to show that many screens.

----------------------------------------------------------
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
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: How to flush the all the screens from Stack

You could query your UiApplication or UiEngine for the top-most screen (getActiveScreen()), pop that screen off the display stack. Repeat this until getActiveScreen() returns null.

Developer
Posts: 142
Registered: ‎06-26-2009
My Device: Not Specified

Re: How to flush the all the screens from Stack

 

Thanks Simon_hain and klyubin for ur replys,

 

That means i need to pop the screen by calling getActiveScreen() until it returns the null.

 

 

Is there any alternative method available to flush all screen from stack at once??, i have searched all apis but i couldnt able to get may be rim has not provided yet.

 

i think, i need to go by ur suggestions to clear the stack.

 

 

Trusted Contributor
Posts: 227
Registered: ‎12-16-2009
My Device: 9530,8900,9000
My Carrier: Airtel,Docomo

Re: How to flush the all the screens from Stack

int j=UiApplication.getUiApplication().getScreenCount();
        for(int i=0;i<j;i++)
        {
            UiApplication.getUiApplication().popScreen();
        }

you can also use this to pop all the screens from the stack.

Lathiya Himanshu
Developer
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm
My Carrier: Verizon,AT&T

Re: How to flush the all the screens from Stack

hey amsiddh

 

i also required such functionality but i also followed the same style of popping out the screen

 

inside a loop i tested the condition that till my active screen gets equal to home screen it will continue popping the screens

 

so that i dont run out of screens