06-12-2010 06:56 AM
i am creating a application which is having a global tab bar .bar will have 4 buttonsand will be seen on every screen. i am not able to find any way , can any one please help me out. its urgent..
06-12-2010 08:37 PM
I have done something similar in past.
1. Create a class that creates the NAVIGATION BAR on bottom.
2. Create a static class Global
a. Create object NAVIGATION BAR in it
b. Create a STATE related to each button on the navigation bar(this will be used to draw the highlighted button of current screen.
3. Every screen you create, add this to your screen on the bottom of it using Vertical Field Manager
Rest of it, i am sure you can figure it out, unfortunatly i cannot disclose the code.
Hope it helps
06-12-2010 08:49 PM
I suspect that the method provided by Zeeshan0581 will not work. The issue is that a Field (or Manager) can only be added to one screen at a time. So the first add of this Global navigation bar will work, but every add to another screen after that will fail with an IllegalStateException telling you that the Field is already parented.
If you want to use this method, you will have to dynamically add and remove this tab bar as Screens are displayed.
While I said this could not be done, of course you can 'simulate' this sort of thing by extending MainScreen, to implement this TabBar, then in your application, each of your screens can extend you MainScreen with tab bar already built in. Looks like a 'global' tab bar, but is actually just a clone.
06-12-2010 11:42 PM
peter is correct you will get an exception this way. I was creating the navigation bar in each screen. here is what i missed
Global class has the following fxn that will create your navigaton bar
public static void drawNavigationBar(MainScreen screen, int setFocusTo)
//add all buttons in hfm
at the end of all screens do the follwing:
Not sure if its the best way to do what you want, but it worked for me.
11-11-2011 12:10 AM
i am facing Illegal statement exception.i am using tab area having 4 buttons.but in hompage i have som input to display.in my case, home page is displayed for the first time next time its throwing error.but for other pages i can easily navigate
plz give me solution
11-11-2011 04:23 AM
It is impossible for us to give you a solution to this problem with the information supplied. But no, we do not want your code. Instead you need to debug this properly. When the Exception occurs (I presume you can replicate this in the SImulator), you need to drill down and find out the Detail message associated with the Exception you are seeing. I am suspecting it will be something like 'already parented' or 'focus set when not on screen', which you should figure out easily by yourself. Even if you can't figure this out, look at the statement in your program that has the problem and figure out what you could have done wrong with that statement. If you can't figure that out, then post the statement in your program that is causing the problem. We might be able to help from that.