C CidTek Active Member Licensed User Longtime User Apr 16, 2011 #1 I have an activity that depending on user action within a listview I want to show a different menu item. That works fine for the first menu item but I can't change the menu item on subsequent user actions in the listview. The only way I can get different menu items is if I destroy the activity to start afresh with a new menu. I need some sort of activity.deletemenu event.
I have an activity that depending on user action within a listview I want to show a different menu item. That works fine for the first menu item but I can't change the menu item on subsequent user actions in the listview. The only way I can get different menu items is if I destroy the activity to start afresh with a new menu. I need some sort of activity.deletemenu event.
Erel B4X founder Staff member Licensed User Longtime User Apr 16, 2011 #2 Currently you cannot remove existing menu items. You can either use multiple activities or you can create a custom panel with buttons instead of the menu. You can catch the Menu button and show it instead of the regular menu. Upvote 0
Currently you cannot remove existing menu items. You can either use multiple activities or you can create a custom panel with buttons instead of the menu. You can catch the Menu button and show it instead of the regular menu.
C CidTek Active Member Licensed User Longtime User Apr 16, 2011 #3 Erel said: Currently you cannot remove existing menu items. You can either use multiple activities or you can create a custom panel with buttons instead of the menu. You can catch the Menu button and show it instead of the regular menu. Click to expand... Is menu removal a feature coming in the future? Upvote 0
Erel said: Currently you cannot remove existing menu items. You can either use multiple activities or you can create a custom panel with buttons instead of the menu. You can catch the Menu button and show it instead of the regular menu. Click to expand... Is menu removal a feature coming in the future?
Erel B4X founder Staff member Licensed User Longtime User Apr 16, 2011 #4 Not in the next version. Maybe later. Upvote 0
I infodata New Member Licensed User Longtime User Nov 16, 2011 #5 Erel said: Not in the next version. Maybe later. Click to expand... Any news regading this? ... Activity.RemoveItem ...? Upvote 0
Erel said: Not in the next version. Maybe later. Click to expand... Any news regading this? ... Activity.RemoveItem ...?
D Dadeda Member Licensed User Longtime User Oct 16, 2014 #6 Is it now possible to removeitem ? or does any owrkaround exist ? Upvote 0
DonManfred Expert Licensed User Longtime User Oct 16, 2014 #7 Dadeda said: Is it now possible to removeitem ? Click to expand... No Dadeda said: or does any owrkaround exist ? Click to expand... not that i know about Upvote 0
Dadeda said: Is it now possible to removeitem ? Click to expand... No Dadeda said: or does any owrkaround exist ? Click to expand... not that i know about
warwound Expert Licensed User Longtime User Oct 17, 2014 #8 What would happen if JavaObject was used to call the Activity invalidateOptionsMenu method to clear all MenuItems? Would you then be able to add new MenuItems? Upvote 0
What would happen if JavaObject was used to call the Activity invalidateOptionsMenu method to clear all MenuItems? Would you then be able to add new MenuItems?
D Dadeda Member Licensed User Longtime User Nov 26, 2014 #9 warwound said: What would happen if JavaObject was used to call the Activity invalidateOptionsMenu method to clear all MenuItems? Would you then be able to add new MenuItems? Click to expand... I would also like to know the answer for this. Upvote 0
warwound said: What would happen if JavaObject was used to call the Activity invalidateOptionsMenu method to clear all MenuItems? Would you then be able to add new MenuItems? Click to expand... I would also like to know the answer for this.
merlin2049er Well-Known Member Licensed User Longtime User Nov 26, 2014 #10 Try another menu, like AHNavigationDrawer. https://www.b4x.com/android/forum/threads/ahnavigationdrawer-native-google-navigation-drawer.31461/ Upvote 0
Try another menu, like AHNavigationDrawer. https://www.b4x.com/android/forum/threads/ahnavigationdrawer-native-google-navigation-drawer.31461/
warwound Expert Licensed User Longtime User Nov 26, 2014 #11 Dadeda said: I would also like to know the answer for this. Click to expand... You'd see no change at all if you called the java method invalidateOptionsMenu(): Calling invalidateOptionsMenu() invalidates the options menu - any currently created options menu is discarded. When the activity next needs to display the options menu, the activity will create a new options menu. The new options menu will be created using all the MenuItems previously added. So you can force the activity to rebuild it's options menu but unless you can access the 'already added' MenuItems and clear them or remove one or more, then the rebuilt options menu will be identical to the invalidated options menu. If, from b4a, you could access and modify the already added MenuItems then you could invalidate the options menu, modify the MenuItems and then when the activity rebuilds the options menu it would reflect the modified MenuItems. Hope i explained that clearly? Martin. Upvote 0
Dadeda said: I would also like to know the answer for this. Click to expand... You'd see no change at all if you called the java method invalidateOptionsMenu(): Calling invalidateOptionsMenu() invalidates the options menu - any currently created options menu is discarded. When the activity next needs to display the options menu, the activity will create a new options menu. The new options menu will be created using all the MenuItems previously added. So you can force the activity to rebuild it's options menu but unless you can access the 'already added' MenuItems and clear them or remove one or more, then the rebuilt options menu will be identical to the invalidated options menu. If, from b4a, you could access and modify the already added MenuItems then you could invalidate the options menu, modify the MenuItems and then when the activity rebuilds the options menu it would reflect the modified MenuItems. Hope i explained that clearly? Martin.
S Silli Member Licensed User Longtime User Nov 27, 2014 #12 Test this for remove and change menu items... https://www.b4x.com/android/forum/threads/class-mutablemenu-alter-menu-at-runtime.30325/ Upvote 0
Test this for remove and change menu items... https://www.b4x.com/android/forum/threads/class-mutablemenu-alter-menu-at-runtime.30325/