Skip to content Skip to sidebar Skip to footer

Creating Options Menu In Android

I am trying to create options menu in my Android program. I am using the following code to inflate options menu : @Override public boolean onCreateOptionsMenu(Menu menu) {

Solution 1:

remove the line super.onCreateOptionsMenu(menu); from your onCreateOptionMenu. You are actually already providing the menu before inflating it.

Solution 2:

Options menu shows up by pressing the Options Menu button at the bottom of the phone

Solution 3:

Don't call

super.onCreateOptionsMenu(menu);

as that will return a value before your code is executed.

Solution 4:

Use this code:

publicbooleanonCreateOptionsMenu(Menu menu) {
      MenuInflaterinflater= getMenuInflater();
      inflater.inflate(R.menu.options_menu, menu);
      returntrue;
    }

Post a Comment for "Creating Options Menu In Android"