Menu item ID is not recognized
- by Alex Farber
menu/activity_main.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_settings"
android:title="@string/menu_settings"
android:showAsAction="never" />
<item android:id="@+id/menu_save_log"
android:title="@string/menu_save_log"
android:showAsAction="never" />
</menu>
MainActivity.java:
//@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_settings: // OK
break;
case R.id.menu_save_log: // menu_save_log cannot be resolved or is not a field
break;
}
return true;
}
Why menu_save_log is not recognized?