android - Options menu doesn't appear any more -


i'm facing strange problem, old android project not showing menu options.

code menu:

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android">      <item android:id="@+id/menu_preferences"           android:icon="@drawable/icon_preferences"           android:showasaction="always"           android:visible="true"           android:title="preferences" />      <item android:id="@+id/menu_datatransfer"           android:icon="@drawable/transfer"           android:showasaction="always"           android:visible="true"           android:title="data transfer" /> </menu> 

and creating menu:

@override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.      menuinflater menuinflater = getmenuinflater();           menuinflater.inflate(r.layout.menu, menu);     return true;  } 

the strange things if put breakpoint on lines debuger doesn't stop on them. seems somehow oncreateoptionsmenu not called while application starting. how possible?

sdk version 17.

you must add onoptionsitemselected below:

@override     public boolean onoptionsitemselected(menuitem item) {         switch (item.getitemid()) {             case r.id.yourid:                 return true;             default:                 return super.onoptionsitemselected(item);         }     } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -