List of usage examples for android.view Menu add
public MenuItem add(int groupId, int itemId, int order, @StringRes int titleRes);
From source file:android.example.com.animationdemos.CardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); item.setIcon(mShowingBack ? R.drawable.ic_action_photo : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;/* ww w . ja v a 2s . c om*/ }
From source file:com.android.settings.profiles.ProfilesSettings.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(0, MENU_RESET, 0, R.string.profile_reset_title).setIcon(R.drawable.ic_settings_backup) // use the backup icon .setAlphabeticShortcut('r').setEnabled(mEnabled) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, MENU_ADD, 0, R.string.profiles_add).setIcon(R.drawable.ic_menu_add).setAlphabeticShortcut('a') .setEnabled(mEnabled)// ww w .j av a 2 s .co m .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); }
From source file:com.lulu.admin.kuyimusic.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // getMenuInflater().inflate(R.menu.main, menu); menu.add(0, MENU_I_LIKE, 1, R.string.my_like_music); menu.add(0, MENU_RESENT, 2, R.string.resent_play_list); menu.add(0, MENU_SETTING, 3, R.string.setting); return super.onCreateOptionsMenu(menu); }
From source file:com.example.getneighborposition.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.activity_main, menu); menu.add(0, MENU_A, 0, "??"); //menu.add(0, MENU_B, 0, "Legal Notices"); return true;//from w ww.j av a2 s .c o m }
From source file:com.mifos.mifosxdroid.online.LoanChargeFragment.java
@SuppressWarnings("deprecation") @Override//from w ww . j a v a 2 s .c o m public void onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuItem menuItemAddNewLoanCharge = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_LOAN_CHARGES, Menu.NONE, getString(R.string.add_new)); menuItemAddNewLoanCharge.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) menuItemAddNewLoanCharge.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onPrepareOptionsMenu(menu); }
From source file:com.nttec.everychan.ui.HistoryFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.add(Menu.NONE, R.id.menu_clear_history, 101, R.string.menu_clear_history) .setIcon(android.R.drawable.ic_menu_close_clear_cancel); }
From source file:com.yeldi.yeldibazaar.ManageRepo.java
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item = menu.add(Menu.NONE, ADD_REPO, 1, R.string.menu_add_repo) .setIcon(android.R.drawable.ic_menu_add); menu.add(Menu.NONE, REM_REPO, 2, R.string.menu_rem_repo) .setIcon(android.R.drawable.ic_menu_close_clear_cancel); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); return true;/*from ww w.j a v a2 s . co m*/ }
From source file:org.lumicall.android.sip.RegisterAccount.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); MenuItem m = menu.add(0, ABOUT_MENU_ITEM, 0, R.string.menu_about); m.setIcon(android.R.drawable.ic_menu_info_details); return result; }
From source file:com.jrummyapps.busybox.fragments.ScriptsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(0, R.id.action_settings, 0, R.string.settings).setIcon(R.drawable.ic_settings_white_24dp) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, R.id.action_info, 0, R.string.about).setIcon(R.drawable.ic_information_white_24dp) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.nttec.everychan.ui.FavoritesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.add(Menu.NONE, R.id.menu_clear_favorites, 101, R.string.menu_clear_favorites) .setIcon(android.R.drawable.ic_menu_close_clear_cancel); }