Android Question Menus between activities

Alberto Michelis

Well-Known Member
Licensed User
Hi,
Any way of having a menu definition in one module and use it in all the activities of the app?

And where can I found the icon of this menu?
Are they an android resource I can use? see image.

Thanks
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
You can use a class to add the menu items (pass the activity as a parameter to the class). The menu click event will still fire on the activity module. You can use a single event for all the menu items and then delegate it to the class. This will allow you to share the code between all the modules:
B4X:
Sub Menu_Click
 MenuHandlerClassInstance.MenuClick(Sender) 'sender will be the menu text
End Sub
 

Alberto Michelis

Well-Known Member
Licensed User
It is this or I need to add the menu, items and click code in all the activities?
Thats what you normally do?
May exists a compiler INCLUDE(file) to include the same code in many modules?
 
Top