views:

68

answers:

1

I use this on one of my screen:

protected void makeMenu(Menu menu, int instance){
if (UserData.sessionId != null){
    menu.add(logOut);
    menu.add(setting);
}
menu.add(exitApp);

}

The "log out" and "setting" menu only appear after the user logs in (hence, the session ID is not null). How to make the "log out" and "setting" disappear from the menu after the user logs out, while the same screen is still being displayed?

invalidate() ?

A: 

makeMenu() should be called every time you press the menu button so you should not need to repaint. Is the UserData.sessionId being correctly updated once the user has logged out?

Also you should call super.makeMenu() when you override makeMenu()

I can't post a link to the java doc as I don't have enough reputation but that is mentioned in there.

Greg McGowan
>>makeMenu() should be called every time you press the menu button so you should not need to repaintAre you sure about this? Because after the user logs out from the app, the log out and setting menu is still visible. I guess something's wrong there. Hmm..>>Is the UserData.sessionId being correctly updated once the user has logged out?Yes. UserData.sessionId is nulled. But let me recheck my code again...
anta40
Again I can't put a link to the blackberry java doc but makeMenu() is called by onMenu() which is called every time a menu is to be displayed. You can have a look yourself to check. Adding some simple logging statements might help or there is an option of using the blackberry eclipse plugin.
Greg McGowan
So, how did you get on? Are you going to update the answer with your progress?
Greg McGowan