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

Native Development

Reply
Developer
shreyansjain
Posts: 146
Registered: ‎07-03-2013
My Device: BB 9360
Accepted Solution

Avoid too many Navigation Stack push objects

Hello, 

In my application, I am using navigation pane to navigate throught my app. So, I have now close to 4-6 different pages in a given stack of a navigation pane, i was just wondering, what could be a good practise to avoid pushing too many pages to the navPane stack?
I used navPane with 4-6 pages in the stack in the first place because the value of selected index from the standard list item determines what to display next. the catch is, if user wants to go back, one has to go all the way back (pop all those pages) to see the homepage. 
Is there any better implementation or idea that could help for this case?

 

Thanks
S.

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Avoid too many Navigation Stack push objects

welcome to the support forums.

there are several possible approaches.
if you don't want to keep the previous page when pushing a new one you can use https://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html#function-remov... to remove the page (after the new one is pushed) silently.

if you want more flexibility you can also use navigateTo to go to any page in your stack.
----------------------------------------------------------
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
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Avoid too many Navigation Stack push objects

I think what would work best for you depends almost entirely on the nature of your app. Maybe you don't even need all those levels of stacking.

In any case, I just wanted to mention that the Back button has a magic property... if the user, rather than tapping on it, swipes it to the right, all the pages should be popped and the user can go directly back to the root page in the stack. It might not be something to rely on, but maybe it is something about which you can inform your users and avoid the concern about too-deep nesting.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
shreyansjain
Posts: 146
Registered: ‎07-03-2013
My Device: BB 9360

Re: Avoid too many Navigation Stack push objects

I already used navigateTo property where I could, but, i'll look into the function to remove the pages silently. hmm, never thought about it.

Thanks
S.
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Avoid too many Navigation Stack push objects

i missed a replace method, and pushing a new page, then removing the old one kind of does that. note that it will not go to the onPopTransitionEnded slot, if you use that to clean created objects you will have to add it here, too.
----------------------------------------------------------
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