i initialize my menu with help of the callback method "public boolean onCreateOptionsMenu(Menu menu)". In this method i also create some member reference to the handed over menu and items i create.
Using java Syntax Highlighting
- public boolean onCreateOptionsMenu(Menu menu)
- {
- this.menu = menu;
- this.menuPlayItem = menu.add(1, 1, "play");
- this.menuPlayItem.setShown(true);
- return super.onCreateOptionsMenu(menu);
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
During runtime i want to manipulate the menu and items but the references i created before are pointing to null!
Using java Syntax Highlighting
- public void someMethod()
- {
- // nullpointer exception
- this.menuPlayItem.setShown(false);
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
any suggestions? tipps? isn't it possible to manipulate the menu outside of "onCreateOptionsMenu"?
the menu is there and selectable and so the references SHOULD point to something useful because "onCreateOptionsMenu" was run successful.
greetings from the java frog


