I had a problem the other day when I needed to alter the text on my Activity menu based on the state of the application (it was for a screen lock so I need to say "Lock Screen" or "Unlock Screen" based on the state).
I couldn't find an easy way to do this but I did come across some code in the thread below that resets the menu using reflection;
http://www.b4x.com/forum/basic4andr...cript-device-basic-programming.html#post99468
So I've extended this to a class that allows you to make changes to the menu at runtime.
Currently it only supports basic menu items (not bitmaps).
You can;
1) Add menu items to the bottom of the menu
2) Add menu items at a specific index
3) Remove menu items
4) Update the text of menu items
Class and demo app attached. It requires the Reflection library in order to operate.
Hope someone finds this useful.
I couldn't find an easy way to do this but I did come across some code in the thread below that resets the menu using reflection;
http://www.b4x.com/forum/basic4andr...cript-device-basic-programming.html#post99468
So I've extended this to a class that allows you to make changes to the menu at runtime.
Currently it only supports basic menu items (not bitmaps).
You can;
1) Add menu items to the bottom of the menu
2) Add menu items at a specific index
3) Remove menu items
4) Update the text of menu items
Class and demo app attached. It requires the Reflection library in order to operate.
Hope someone finds this useful.