@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); if (helpVariant.equals(HelpVariant.distribution)) { inflater.inflate(R.menu.distribution, menu); } else { inflater.inflate(R.menu.categories, menu); } super.onCreateOptionsMenu(menu); return true; }
@Override public void onCreate(Bundle savedInstanceState) { setTheme(MyApplication.getThemeId()); super.onCreate(savedInstanceState); Intent intent = getIntent(); String action = intent.getAction(); Bundle extras = intent.getExtras(); if (action != null && action.equals("myexpenses.intent.manage.categories")) { helpVariant = HelpVariant.manage; setTitle(R.string.pref_manage_categories_title); } else if (extras != null) { helpVariant = HelpVariant.distribution; // title is set in categories list } else { helpVariant = HelpVariant.select; setTitle(R.string.select_category); } setContentView(R.layout.select_category); }