title: How do I programmatically check if the menu of my activity is showing at a particular moment?
body: <p>An Android device configuration change (for example "slide the hard keyboard back in") will always call <code>PhoneWindow.onConfigurationChanged()</code>, which in turn, will call <code>reopenMenu()</code>. This will cause the menu of the currently running activity to be reopened, in case it is showing.</p>
  
  <p>I have a lock on my menu implemented in my <code>onPrepareOptionsMenu()</code> override. The user must enter a code each time they want to see the menu. I don't want the user to be asked to enter the code again, while the menu is still up just because of a configuration change. Thus, I would like to know, is there any way I can check if the menu of current foreground activity is already showing? Knowing this, I could bypass asking for the access code if the menu is already up.</p>
  
  <p>My custom workaround implementation is to use my own flag <code>menuShowing</code>, which I set in <code>onPrepareOptionsMenu</code> and reset in <code>onOptionsItemSelected</code> and in <code>onKeyDown</code> if the back button is clicked.</p>
  
  <p><code>EDIT:</code> It appears a screen orientation configuration change does not trigger this behavior. A hard keyboard slide however, does.</p>