0

I understand that for Android 3.0 the menus will become action bars.

But, in my program the menu that's displayed is based upon what variable is set/what the program is doing. I.E. I expect users to request the menu, and the menu that's shown is based upon the value of "menuselect". If the actions bar is automatically created, how will users get to select which menu is shown?

How would this kind of menu be processed/shown:

public boolean onCreateOptionsMenu(Menu menu) {

if (menuselect == 1)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}

else {

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu2, menu);
return true;

}

}

Thanks,

Marc Brown
  • 601
  • 2
  • 11
  • 26
  • A menu will be created either from menu or from menu2 resource. Was that the question? – Alexander Kulyakhtin May 16 '12 at 20:44
  • he wants to know how he can create this for the action bar – tyczj May 16 '12 at 20:49
  • Here's the scenario: When the app first starts the regular "menu" will be selected as the variable "menuselect" is equal to one. When the user wants to take a picture "menuselect" will change to 2 and "menu2" will become the default menu. What I wanted to know, since the action bar will be created automatically, is: will "menu" only be able to show, how will "menu2" show if menus are changed to action bars and the menu button will be no longer available? – Marc Brown May 16 '12 at 20:50

1 Answers1

1

The action bar is not dynamic like that, it gets created only once when the activity starts and you cannot change it after that

tyczj
  • 71,600
  • 54
  • 194
  • 296