title: android - change options menu dynamically , but by inflating from XML
body: <p>i need to be able to change the options menu (the one that is shown upon pressing the menu button) on android , so that on one case (for example upon a button being pressed) , it will use a specific menu resource (XML file as in /res/menu/... ) for the menu , and on another case , use a different XML file.</p>
  
  <p>so far i've seen only examples of doing it without xml (example <a href="https://stackoverflow.com/questions/5876109/how-to-programatically-change-an-item-in-the-options-menu">here</a> and <a href="http://russenreaktor.wordpress.com/2010/02/28/solved-android-dynamically-change-options-menu-items/" rel="nofollow noreferrer">here</a>) , and they worked fine , but i want to be able to change the entire menu on some cases.
  i've tried to modify the solutions i've found , but none of my trials worked.</p>
  
  <p>if possible , i would prefer to re-create the menu only if the it needs to be updated with a menu resource that is different from the current one.</p>
  
  <p>please help me.</p>