Search code examples
androidbuttonandroid-activitymenushare

Sharing menu bar between activities


I have a menu bar on my app, that I need to share between 5 of my activities. My menu bar (= 5 buttons allowing to switch between activities) has exactly the same UI and the same behavior for any activity so I would like to share both menu bar XML view code and controller code.

I already found a way to share the XML code using Reusable UI Components but I can't find a way to share the controller code that controls the menu bar buttons clicks.

Note: my menu bar is a custom-made one, not the Android Options Menu one.

Thanks in advance.


Solution

  • I think the best solution is to use Fragments, using the Android Support v4 library