Note that there are some explanatory texts on larger screens.

plurals
  1. POOptions menu not showing in ICS using compatibility library
    text
    copied!<p>I can't get an options menu to show in a Fragment in ICS in a project which uses the android-support-v4.jar library. I'm testing on a Galaxy Nexus handset.</p> <p>We aren't using the action bar, and need the app to be 2.2+ compatible. We aren't seeing any options menu in the activity in ICS (the FragmentActivity doesn't support onCreateOptionsMenu)</p> <p>I can get menus working in previous version of Android - I have all the correct framework to enable the options menu (as below) but nothing shows in ICS. When stepping through the code the onCreateOptionsMenu doesn't get called. Can anyone suggest a fix?</p> <pre><code>import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; public class SuperFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { setHasOptionsMenu(true); super.onCreate(savedInstanceState); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.display_options_actions, menu); super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.menu_sign_in: break; case R.id.menu_sign_out: break; } return true; } // ... } </code></pre> <p>Target OS version in the manifest file:</p> <pre><code>&lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload