I have one problem using ActivityGroup. I have two activities inside an ActivityGroup and both of them use a menu (overriding the onCreateOptionMen
Yet another approach is to create the menu in the ActivityGroup root and then use public boolean onPrepareOptionsMenu(Menu menu) to clear and re-add menu items.
In ActivityGroup class:
@Override public boolean onCreateOptionsMenu(Menu menu) { //what is the current activity? menu.add(0, 0, 0, "holder"); return true; } @Override public boolean onPrepareOptionsMenu(Menu menu) { //start a new menu.clear(); //add some menu options .getLocalActivityManager().getCurrentActivity().onPrepareOptionsMenu(menu); return super.onPrepareOptionsMenu(menu); }
In Activity:
@Override public boolean onPrepareOptionsMenu(Menu menu) { //add menus or inflate here return true; }