when one of my menu is open and i am pressing red button, my application goes to background. when i comes back to the application the menu will be open.
In some cases its ok for me, but in some cases i want to close that menu..
deleting all items from menu will give an <empty menu> when the menu is invoked...,
is there any way by which <empty menu> will not come when no menu items are there in the menu?
I can set a flag for the exceptional case which i am getting and if the flag is true i will delete all menuitems. But still a menu with<empty menu> entry will come. how can i remove that also?
Can you post a code-snippet showing the behavior you're describing? otherwise we're all just playing a guessing game.
If I'm reading what you say correctly the MainScreen onExposed method isn't firing when you return to your application because the menu is open (and therefore the screen isn't exposed - this is guesswork, not 100% sure). What you could do here is use:
public class myApp extends UiApplication {
MyScreen screen = new MyScreen();
public static void main(String[] args) {
myApp instance = new myApp();
instance.enterEventDispatcher();
}
public myApp() {
pushScreen(screen);
}
public void activate() {
screen.getMenu(Menu.INSTANCE_DEFAULT).close();
}
}
'activate' is a method within your UiApplication class that is called when your app is brought to the foreground.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
on exposed event is getting fired.. inside that i am checking whether the screen is visible or not... when on exposed event is occurring screen.isvisible() is returning false. then the makemenu event is getting fired. there also visibility is false. once the menu is opened, the screens visibility is becoming true...
and this problem happens only when the screen contains an ObjectListField.
what happens in my case is I have a screen with an ObjectListField, which contains 5 items. i have add, edit and delete in my menu.
when i delete an item a new popup screen comes up where u have to enter password. enter password and click trackball if the password is correct, the password screen will get closed and item gets deleted.
then you will come back to the screen where the ObjectListField is there.
then the above metioned problem happens ie the menu of the screen is poping up...
if you edit or add new enements, a new screen will come and you can add elements to the ObjectListField and you save it.the screen will get closed and will come back to the ObjectListField's screen.
in this case menu is not poping up in simulators, but when u install it and run in blackberry device, it comes up
so this isn't to do with pressing the red button and sending the app to the background? if the behavior only happens in a device and not the emulator it could be a bug, but i'm confused as i'm reading different things. if the popup is modal you could be returning false from the click event which is firing the menu after you pop the password screen - but without seeing the code i can't help anymore (and given the behavior is only seen on a real device it may well be a bug). anyone else have better clarity? i'm all out of ideas.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!