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

Web and WebWorks Development

Posts: 27
Registered: ‎05-13-2010
My Device: Storm
My Carrier: Verizon

UI Navigation & Stack - Need Moderators Help

Hi Guys,


I have a question related to Basics i.e UI Navigation & Stack. I hope the Moderators will show interest in this post. 


I have two screens :-


Screen 1 - Grid Main Menu - Main menu where all the elements are present in a grid.


Screen 2 - Display Information Screen - which displays the information like "Data Stored Successfully" etc.


When i am moving from Screen 1 (Grid Main Menu) to Screen 2 (Display Information Screen), i am using the code given below :-


ApplnName.instance().displayinfo = new DisplayInfo("TITLE_SCREEN_NAME"," Data Stored Sucessfully.");


Display Info class has a constructor with DisplayInfo(String Title,String Data){ }, where we are pushing Display Info screen.

Now once we are in the Display Info Screen where the information "Data Stored Sucessfully" is shown. Then if we click on the Back Key, Screen Navigation is being handled used the following code :-


protected boolean keyDown(int keycode, int time){
        if (Keypad.key(keycode) == Keypad.KEY_ESCAPE){


 // Popping the current active screen twice


 // Setting Screen Number

                ApplnName.instance().mainmenu = new GridMainMenu();
                clearAllVariables( );
                ApplnName.instance().displayinfo = null;


Previously i was not manually handling Back Key, It was automatically handling the screen navigation due to stack. But i read many posts about UI Implementation related to Stack, where they have mentioned that we have to clear the stack as much as possible. So i am clearing the stack twice and controlling the navigation using Screen Numbers.


Is this the correct / efficient way of navigation ?


Can anyone please advise me on this topic ?


Thanks in advance. I request the Moderators to have a look at this topic. If answered correctly, this might help Newbies to learn quickly.





Posts: 27
Registered: ‎05-13-2010
My Device: Storm
My Carrier: Verizon

Re: UI Navigation & Stack - Need Moderators Help

Is there a method to clear the entire Stack at once  instead of doing it twice ?



Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: UI Navigation & Stack - Need Moderators Help

Your post will likely have a better chance being answered over in the Java forums.  The web forums are mainly for HTML, CSS, JavaScript questions and Browser/Widget specific questions.


Would you like me to move your post for you?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter