List of usage examples for android.view Menu add
public MenuItem add(int groupId, int itemId, int order, @StringRes int titleRes);
From source file:com.example.android.animationsdemo.GirdPagerSearchBarActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mInnerPager.getCurrentItem() > 0); mPrev.setEnabled(mInnerPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mInnerPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish : R.string.action_next); mNext.setEnabled(!(mInnerPager.getCurrentItem() == mPagerAdapter.getCount() - 1)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;/*from w ww. j ava 2 s .c o m*/ }
From source file:mtmo.test.mediadrm.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, MENU_ID_MENU1, Menu.NONE, "Switch Mode"); return super.onCreateOptionsMenu(menu); }
From source file:com.acrylicgoat.devchat.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear();//from w w w .j a v a 2 s .c o m getMenuInflater().inflate(R.menu.activity_main, menu); readDB(); if (devs != null && devs.size() > 0) { for (int i = 0; i < devs.size(); i++) { Developer dev = devs.get(i); menu.add(0, MENUITEM, 0, dev.getName()); } } boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList); menu.findItem(R.id.save).setVisible(!drawerOpen); return true; }
From source file:com.android.music.AlbumBrowserActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, PARTY_SHUFFLE, 0, R.string.party_shuffle); // icon will be set in onPrepareOptionsMenu() menu.add(0, SHUFFLE_ALL, 0, R.string.shuffle_all).setIcon(R.drawable.ic_menu_shuffle); return true;/*from w w w . j ava 2 s.c o m*/ }
From source file:goo.TeaTimer.TimerActivity.java
/** { @inheritDoc} */ @Override//from w w w. j a v a 2 s . c om public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add(0, PREF, 0, getResources().getString(R.string.prefs)); MenuItem about = menu.add(1, 1, 0, getResources().getString(R.string.about)); item.setIcon(android.R.drawable.ic_menu_preferences); about.setIcon(android.R.drawable.ic_menu_info_details); return super.onCreateOptionsMenu(menu); }
From source file:com.andybotting.tubechaser.activity.Home.java
/** * Create the options menu// w w w . java2 s .c om */ public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MENU_REFRESH, 0, R.string.menu_item_refresh).setIcon(R.drawable.ic_menu_refresh); menu.add(0, MENU_ABOUT, 0, R.string.menu_item_about).setIcon(android.R.drawable.ic_menu_help); menu.add(0, MENU_SETTINGS, 0, R.string.menu_item_settings).setIcon(android.R.drawable.ic_menu_preferences); menu.add(0, MENU_SEARCH, 0, R.string.menu_item_search) .setIcon(android.R.drawable.ic_search_category_default) .setAlphabeticShortcut(SearchManager.MENU_KEY); return true; }
From source file:org.rapidandroid.activity.FormReviewer.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu); menu.add(0, MENU_DONE, 0, R.string.formreview_menu_done).setIcon(android.R.drawable.ic_menu_revert); menu.add(0, MENU_FORMAT, 0, R.string.formreview_menu_format) .setIcon(android.R.drawable.ic_menu_info_details); menu.add(0, MENU_DUMP_CSV, 0, R.string.formreview_dump_csv).setIcon(android.R.drawable.ic_menu_save); menu.add(0, MENU_SCHEDULE_DUMP_CSV, 0, R.string.formreview_schedule_dump_csv) .setIcon(android.R.drawable.ic_menu_agenda); // menu.add(0, MENU_HTTP_UPLOAD, 0, R.string.formreview_upload_csv).setIcon(android.R.drawable.ic_menu_upload); //menu.add(0, MENU_INJECT_DEBUG, 0, "Generate Data").setIcon(android.R.drawable.ic_menu_manage); return true;/*ww w. jav a 2s .c o m*/ }
From source file:org.geometerplus.android.fbreader.network.NetworkLibraryActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (myOptionsMenuActions.isEmpty()) { fillOptionsMenuList();// w w w. java 2 s. c o m } for (Action a : myOptionsMenuActions) { final MenuItem item = menu.add(0, a.Code, Menu.NONE, ""); if (a.IconId != -1) { item.setIcon(a.IconId); } } return true; }
From source file:com.wirelessmoves.cl.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, RESET_COUNTER, 0, "Rest Counters"); menu.add(0, ABOUT, 0, "About"); menu.add(0, TOGGLE_DEBUG, 0, "Toggle Debug Mode"); //TODO add the exists menu item... return true;//from w w w .jav a 2 s . c o m }
From source file:com.andybotting.tramhunter.activity.StopDetailsActivity.java
/** * Create the options for a given menu/* w w w. jav a2 s . c o m*/ */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MENU_ITEM_REFRESH, 0, "Refresh"); MenuItem menuItem1 = menu.findItem(MENU_ITEM_REFRESH); menuItem1.setIcon(R.drawable.ic_menu_refresh); menu.add(0, MENU_ITEM_FAVOURITE, 0, ""); // Title set in onMenuOpened() MenuItem menuItem2 = menu.findItem(MENU_ITEM_FAVOURITE); menuItem2.setIcon(R.drawable.ic_menu_star); menu.add(0, MENU_ITEM_MAP, 0, "Map"); MenuItem menuItem3 = menu.findItem(MENU_ITEM_MAP); menuItem3.setIcon(R.drawable.ic_menu_mapmode); return true; }